/* ============================================================
   Ai课堂 SEO 门户 - 简洁样式
   ============================================================ */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --ink: #1f2937;
  --ink-soft: #4b5563;
  --ink-muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2f5ce3;
  --accent-dark: #1f3fae;
  --accent-soft: #eef2ff;
  --on-accent: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .10);
  --maxw: 1080px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 40px 20px; }

h1, h2, h3, h4 { line-height: 1.3; font-weight: 700; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px; color: var(--ink);
}
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px;
  object-fit: cover; flex: none; display: inline-block;
}
.brand-logo--sm { width: 32px; height: 32px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #6a5ae0);
  color: #fff; font-weight: 800; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-text { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-text em {
  font-style: normal; color: var(--ink-muted); font-weight: 400;
  font-size: 12.5px; letter-spacing: .04em;
  margin-left: 10px; padding-left: 11px; border-left: 1px solid var(--line);
  white-space: nowrap;
}
.site-nav { display: flex; gap: 22px; align-items: center; }
.site-nav a { color: var(--ink-soft); font-size: 15px; font-weight: 500; }
.site-nav a:hover { color: var(--accent); }
.site-nav a.active { color: var(--accent); font-weight: 700; }
.site-nav a.nav-muted { color: var(--ink-muted); font-weight: 400; }

/* ---------------- Hero ---------------- */
.hero {
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(47, 92, 227, .10), transparent 60%),
    linear-gradient(180deg, #f4f7ff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
  padding: 64px 20px 56px;
  text-align: center;
}
.hero-title { font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.5px; }
.hero-sub { max-width: 720px; margin: 16px auto 0; color: var(--ink-soft); font-size: 17px; }
.hero-stats { display: flex; gap: 36px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.hero-stats span { color: var(--ink-soft); font-size: 14px; }
.hero-stats b { display: block; font-size: 26px; color: var(--accent); font-weight: 800; }

/* ---------------- Section titles ---------------- */
.section-title { font-size: 22px; font-weight: 700; margin: 0 0 20px; }
.section-title::after { content: ""; display: block; width: 40px; height: 3px; border-radius: 2px; background: var(--accent); margin-top: 8px; }

/* ---------------- 首页实用工具小标签 ---------------- */
.tools-strip { border-top: 1px solid var(--line); }
.tools-strip .section-title { margin-bottom: 6px; }
.tool-cat-title { font-size: 13px; font-weight: 700; color: var(--ink-muted); margin: 18px 0 10px; }
.tool-tags { display: flex; flex-wrap: wrap; margin-bottom: 6px; }
.tool-tag {
  display: inline-flex; align-items: center; position: relative; padding: 4px 13px; margin: 0 8px 8px 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-soft); color: var(--ink-soft);
  font-size: 12.5px; font-weight: 500; line-height: 1.6;
  transition: all .15s ease;
}
.tool-tag:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }

/* 悬停工具简介 tooltip */
.tool-tag::before,
.tool-tag::after {
  content: ""; position: absolute; left: 50%; z-index: 40;
  transform: translateX(-50%);
  opacity: 0; visibility: hidden;
  transition: opacity .15s ease, visibility .15s ease;
  pointer-events: none;
}
.tool-tag::after {
  content: attr(data-tip);
  bottom: calc(100% + 10px);
  width: max-content; max-width: 260px;
  padding: 7px 12px; border-radius: 8px;
  background: #1e293b; color: #f8fafc;
  font-size: 12.5px; line-height: 1.6; text-align: left; font-weight: 400;
  box-shadow: 0 10px 26px rgba(16, 24, 40, .22);
}
.tool-tag::before {
  bottom: calc(100% + 5px);
  width: 9px; height: 9px;
  background: #1e293b;
  transform: translateX(-50%) rotate(45deg);
}
.tool-tag:hover::before,
.tool-tag:hover::after { opacity: 1; visibility: visible; }

/* ---------------- Course grid & cards ---------------- */
.course-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.course-card { display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .18s ease, box-shadow .18s ease; }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #cfd8f5; }
.course-card-link { display: flex; flex-direction: column; flex: 1; padding: 20px 20px 14px; color: var(--ink); }
.course-card-head { display: flex; gap: 8px; margin-bottom: 12px; min-height: 22px; }
.course-card-title {
  font-size: 18px; font-weight: 700; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: calc(18px * 1.4 * 2);
}
.course-card-school { color: var(--ink-muted); font-size: 13px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-card-desc {
  color: var(--ink-soft); font-size: 14px; margin-top: 10px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; min-height: calc(14px * 1.6 * 3);
}
.course-card-meta { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 13px; }
.course-card-meta .more { margin-left: auto; color: var(--accent); font-weight: 600; white-space: nowrap; }
.card-main-cta {
  display: block; text-align: center; margin: 12px 20px 20px; padding: 12px 14px;
  border-radius: 10px; background: linear-gradient(135deg, #ff8a3d, #ff5f45);
  color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .02em;
  box-shadow: 0 6px 16px rgba(255, 95, 69, .28);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.card-main-cta:hover { transform: translateY(-1px); box-shadow: 0 9px 22px rgba(255, 95, 69, .36); filter: brightness(1.05); }
.card-main-cta:active { transform: translateY(0); }

/* ---------------- Tags / chips ---------------- */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.tag-school { background: #eef6f0; color: #1f7a4d; }
.tag-online { background: #fff4e5; color: #b45309; }
.tag-keyword { background: var(--bg-soft); color: var(--ink-soft); border: 1px solid var(--line); }
.keyword-list { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------- Buttons ---------------- */
.btn { display: inline-block; padding: 10px 20px; border-radius: var(--radius-sm); font-weight: 600; font-size: 15px; border: 0; cursor: pointer; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-dark); color: var(--on-accent); }

/* ---------------- Breadcrumb ---------------- */
.breadcrumb { padding: 16px 20px 0; font-size: 13px; color: var(--ink-muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.breadcrumb span { color: var(--line); }
.breadcrumb a { color: var(--ink-muted); }
.breadcrumb a:hover { color: var(--accent); }

/* ---------------- Course detail ---------------- */
.course-detail-head { padding: 28px 0 8px; }
.course-detail-tags { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.course-detail-title { font-size: clamp(26px, 3.4vw, 34px); font-weight: 800; letter-spacing: -.4px; }
.course-detail-teacher { color: var(--ink-soft); margin-top: 8px; }
.course-detail-stats { display: flex; gap: 24px; margin: 16px 0 20px; color: var(--ink-soft); font-size: 14px; }
.course-detail-stats b { color: var(--accent); font-size: 20px; margin-right: 2px; }
.course-detail-body { display: grid; grid-template-columns: 1fr 300px; gap: 40px; padding-bottom: 40px; }
.course-desc { color: var(--ink-soft); white-space: pre-line; }
.course-desc p { margin-bottom: 10px; }
.aside-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.course-detail-aside { border-left: 1px solid var(--line); padding-left: 24px; }
.type-list { list-style: none; }
.type-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.type-list a { color: var(--ink-soft); }
.type-list a:hover { color: var(--accent); }
.type-label { color: var(--accent); font-weight: 700; }
.type-total { border-bottom: 0 !important; }
.type-total a { color: var(--accent); font-weight: 600; }
.chapter-list { list-style: none; font-size: 14px; color: var(--ink-soft); }
.chapter-list li { padding: 6px 0; }

/* ---------------- Knowledge tree ---------------- */
.knowledge-tree { margin-bottom: 8px; }
.ktree, .ktree-children { list-style: none; margin: 0; padding: 0; }
.ktree-children { padding-left: 22px; border-left: 1px dashed var(--line); margin-left: 10px; }
.ktree-node { margin: 2px 0; }
.ktree-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 10px; border-radius: var(--radius-sm);
}
.ktree-row:hover { background: var(--bg-soft); }
.ktree-name { color: var(--ink); font-size: 14px; }
.ktree-counts { display: inline-flex; gap: 6px; flex: none; }
.ktree-count { font-size: 12px; padding: 1px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.ktree-ex { background: var(--accent-soft); color: var(--accent); }
.ktree-res { background: #eef6f0; color: #1f7a4d; }

/* ---------------- Exercises page ---------------- */
.exercise-page { padding-top: 24px; }
.exercise-head { margin-bottom: 24px; }
.exercise-title { font-size: clamp(24px, 3vw, 30px); font-weight: 800; }
.exercise-sub { color: var(--ink-soft); margin-top: 8px; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.chip { padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-soft); font-size: 14px; font-weight: 500; background: var(--bg); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip-active:hover { color: var(--on-accent); }

/* ---------------- Questions ---------------- */
.question-list { display: flex; flex-direction: column; gap: 16px; }
.question { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--bg); }
.question-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.question-type { display: inline-block; padding: 2px 10px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.question-score { font-size: 12px; color: var(--ink-muted); }
.question-content { color: var(--ink); font-size: 15px; }
.question-content p { margin-bottom: 6px; }
.no-copy { -webkit-user-select: none; user-select: none; }
.option-list { list-style: none; margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-soft); font-size: 15px; }
.option-letter { flex: none; width: 24px; height: 24px; border-radius: 6px; background: #fff; border: 1px solid var(--line); color: var(--ink-soft); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.option-text { color: var(--ink-soft); }
.question-foot { margin-top: 12px; }
.question-link { font-size: 14px; font-weight: 600; }

/* ---------------- Pagination ---------------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 32px; flex-wrap: wrap; }
.page-link { display: inline-flex; align-items: center; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink-soft); font-size: 14px; }
.page-link:hover { border-color: var(--accent); color: var(--accent); }
.page-current { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 700; }
.page-ellipsis { padding: 8px 4px; color: var(--ink-muted); }

/* ---------------- Question detail ---------------- */
.question-detail { padding-top: 24px; }
.question-detail-head { margin-bottom: 20px; }
.question-detail-title { font-size: clamp(22px, 3vw, 28px); font-weight: 800; }
.question-detail-meta { margin-top: 10px; }
.back-link { font-size: 14px; color: var(--ink-soft); }
.back-link:hover { color: var(--accent); }
.question-detail-extra { margin-top: 24px; padding: 20px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); }
.question-detail-extra h2 { font-size: 16px; margin-bottom: 8px; }
.question-detail-extra p { color: var(--ink-soft); font-size: 14px; margin-bottom: 6px; }

/* ---------------- 404 ---------------- */
.notfound { text-align: center; padding: 90px 20px; }
.notfound-title { font-size: 30px; font-weight: 800; }
.notfound-text { color: var(--ink-soft); margin: 12px 0 24px; }

/* ---------------- Footer ---------------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); margin-top: 40px; padding: 32px 0; }
.footer-inner { display: flex; flex-direction: column; gap: 14px; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.footer-brand-name { font-weight: 700; font-size: 16px; color: var(--ink); letter-spacing: .02em; }
.footer-slogan { font-size: 12px; color: var(--ink-muted); letter-spacing: .05em; margin-top: 3px; }
.footer-links { font-size: 13px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.footer-label { color: var(--ink-muted); }
.footer-links a { color: var(--ink-soft); }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: 12px; color: var(--ink-muted); }
.footer-beian {
  order: 99; text-align: center; font-size: 12px; color: var(--ink-muted);
  margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line);
}
.footer-beian a { color: var(--ink-muted); transition: color .15s ease; }
.footer-beian a:hover { color: var(--accent); }

/* ---------------- Traffic guidance (main-site) ---------------- */
.traffic-strip { background: linear-gradient(90deg, var(--accent), #6a5ae0); color: #fff; font-size: 14px; }
.traffic-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; flex-wrap: wrap; }
.traffic-link { color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.traffic-link:hover { color: #ffe9b0; }
.traffic-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 18px; padding: 16px 18px; border-radius: var(--radius);
  background: linear-gradient(120deg, var(--accent-soft), #f6f0ff);
  border: 1px solid #dbe3ff;
}
.traffic-card-text { display: flex; flex-direction: column; gap: 2px; }
.traffic-card-text strong { font-size: 15px; color: var(--accent-dark); }
.traffic-card-text span { font-size: 13px; color: var(--ink-soft); }
.seo-note { margin-top: 28px; color: var(--ink-muted); font-size: 13px; }
.seo-note-link { font-weight: 600; }

/* ---------------- Admin login ---------------- */
.admin-login-wrap { max-width: 400px; margin: 80px auto; padding: 0 20px; }
.admin-login { display: flex; flex-direction: column; gap: 20px; }
.admin-login h1 { font-size: 22px; text-align: center; }
.admin-login label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-soft); }
.admin-login input { padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 16px; }
.admin-login .btn { align-self: center; }
.admin-err { color: #dc2626; font-size: 14px; background: #fef2f2; padding: 8px 14px; border-radius: var(--radius-sm); }

/* ---------------- Admin shell ---------------- */
.admin-shell { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.admin-head h1 { font-size: 22px; font-weight: 800; }
.admin-head-actions { display: flex; gap: 10px; align-items: center; }
.admin-empty { color: var(--ink-muted); padding: 40px 0; text-align: center; }
.btn-ghost { padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); color: var(--ink-soft); font-size: 14px; background: var(--bg); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------- Admin table ---------------- */
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--line); color: var(--ink-muted); font-weight: 600; white-space: nowrap; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.td-title { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-title a { color: var(--ink); font-weight: 500; }
.td-title a:hover { color: var(--accent); }
.th-ops, .td-ops { text-align: right; white-space: nowrap; }
.td-ops .op-link { padding: 4px 10px; font-size: 13px; border-radius: 6px; background: var(--bg-soft); color: var(--accent); border: 0; cursor: pointer; }
.td-ops .op-link:hover { background: var(--accent-soft); }
.op-danger { color: #dc2626 !important; }
.op-danger:hover { background: #fef2f2 !important; }
.inline-form { display: inline; }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-published { background: #eef6f0; color: #1f7a4d; }
.status-draft { background: #fff4e5; color: #b45309; }

/* ---------------- Admin tabs ---------------- */
.admin-tabs { display: inline-flex; gap: 4px; background: var(--bg-soft); border: 1px solid var(--line); padding: 4px; border-radius: 10px; margin-bottom: 20px; }
.admin-tab { padding: 7px 18px; font-size: 14px; font-weight: 600; border: 0; border-radius: 7px; background: transparent; color: var(--ink-muted); cursor: pointer; }
.admin-tab-active { background: var(--bg); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------------- Course list + knowledge tree ---------------- */
.course-tree-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
.course-side { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); }
.course-side-title { padding: 12px 16px; font-size: 14px; font-weight: 700; color: var(--ink-soft); border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.course-nav { list-style: none; max-height: 560px; overflow: auto; }
.course-nav-item { display: block; width: 100%; text-align: left; padding: 12px 16px; font-size: 14px; color: var(--ink-soft); background: transparent; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.course-nav-item:hover { background: var(--accent-soft); color: var(--accent); }
.course-nav-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.tree-pane { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); min-height: 320px; }
.tree-pane-title { padding: 12px 16px; font-size: 14px; font-weight: 700; color: var(--ink-soft); border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.tree-loading { padding: 24px; color: var(--ink-muted); font-size: 14px; }
.knowledge-tree { padding: 16px 20px; }
.ktree, .ktree ul { list-style: none; margin: 0; padding-left: 0; }
.ktree ul { padding-left: 22px; }
.ktree li { position: relative; }
.ktree li::before { content: ''; position: absolute; left: -14px; top: 0; bottom: 0; border-left: 1px dashed var(--line); }
.ktree li:last-child::before { height: 24px; }
.knode { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 4px 0; border-radius: 8px; border: 1px solid transparent; }
.knode:hover { background: var(--bg-soft); border-color: var(--line); }
.knode::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.knode-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.knode-count { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }
.knode .btn-xs { margin-left: auto; }
.btn-xs { padding: 4px 12px; font-size: 12px; border-radius: 6px; }
.btn-xs:hover { opacity: .92; }

/* ---------------- Admin form ---------------- */
.admin-form { display: flex; flex-direction: column; gap: 20px; max-width: 800px; }
.form-row label { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.form-label em { color: #dc2626; }
.form-row input, .form-row select, .form-row textarea { padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 15px; }
.form-row textarea { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; line-height: 1.5; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-actions { display: flex; gap: 12px; align-items: center; }
.md-editor { min-height: 320px; }

/* ---------------- Markdown editor widget ---------------- */
.md-editor-widget { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); }
.md-editor-toolbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 8px; border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.md-tbtn { min-width: 34px; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink-soft); font-size: 13px; font-weight: 600; cursor: pointer; }
.md-tbtn:hover { border-color: var(--line); background: var(--bg); color: var(--accent); }
.md-toolbar-spacer { flex: 1; }
.md-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.md-tab { padding: 5px 14px; font-size: 13px; border: 0; background: var(--bg); color: var(--ink-muted); cursor: pointer; }
.md-tab-active { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.md-editor-widget textarea.md-editor { width: 100%; box-sizing: border-box; border: 0; border-radius: 0; min-height: 320px; resize: vertical; }
.md-preview { padding: 16px 18px; min-height: 320px; max-height: 560px; overflow: auto; }
.md-preview p { margin-bottom: 1em; }
.md-preview h1, .md-preview h2, .md-preview h3 { margin: 1.2em 0 .5em; }
.md-preview ul, .md-preview ol { margin: .5em 0 1em 1.5em; }
.md-preview img { max-width: 100%; }
.md-preview table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.md-preview th, .md-preview td { padding: 8px 12px; border: 1px solid var(--line); text-align: left; }
.md-preview th { background: var(--bg-soft); font-weight: 600; }
.md-preview blockquote { border-left: 4px solid var(--accent); padding-left: 14px; margin: 1em 0; color: var(--ink-soft); }

/* ---------------- Content detail (public) ---------------- */
.content-article { padding: 32px 20px 48px; max-width: 780px; }
.content-head { margin-bottom: 28px; }
.content-title { font-size: clamp(26px, 4vw, 36px); font-weight: 800; letter-spacing: -.3px; }
.content-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.content-date { font-size: 13px; color: var(--ink-muted); }
.content-body { font-size: 16px; line-height: 1.8; color: var(--ink); }
.content-body p { margin-bottom: 1em; }
.content-body h2 { font-size: 22px; font-weight: 700; margin: 1.5em 0 .5em; }
.content-body h3 { font-size: 18px; font-weight: 700; margin: 1.4em 0 .4em; }
.content-body ul, .content-body ol { margin: .5em 0 1em 1.5em; }
.content-body li { margin-bottom: .3em; }
.content-body code { background: var(--bg-soft); padding: 2px 6px; border-radius: 4px; font-size: 14px; }
.content-body pre { background: var(--ink); color: #e5e7eb; padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 14px; line-height: 1.5; margin: 1em 0; }
.content-body pre code { background: transparent; padding: 0; color: inherit; }
.content-body blockquote { border-left: 4px solid var(--accent); padding-left: 16px; margin: 1em 0; color: var(--ink-soft); }
.content-body table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.content-body th, .content-body td { padding: 8px 12px; border: 1px solid var(--line); text-align: left; }
.content-body th { background: var(--bg-soft); font-weight: 600; }
.content-body a { color: var(--accent); text-decoration: underline; }
.content-foot { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }

/* ---------------- Copy-protection toast ---------------- */
.copy-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px);
  background: rgba(31, 41, 55, .95); color: #fff; font-size: 14px;
  padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  z-index: 100; max-width: 90vw; text-align: center;
}
.copy-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   Course detail — "知识档案" editorial redesign
   Scoped under .course-page (header/footer stay global).
   ============================================================ */
.course-page {
  --paper: #faf6ee;
  --paper-deep: #f1e9d8;
  --ink: #2b2620;
  --ink-soft: #5c554a;
  --ink-muted: #8a8172;
  --line: #e3d9c6;
  --line-strong: #cdbfa4;
  --seal: #b03a2e;
  --seal-dark: #8f2f25;
  --seal-soft: #f6e4df;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", SimSun, serif;
  background: var(--paper);
  color: var(--ink);
}

/* ---- breadcrumb ---- */
.cpage-breadcrumb { border-bottom: 1px solid var(--line); background: var(--paper); }
.cpage-breadcrumb .container { display: flex; gap: 10px; align-items: center; padding: 14px 20px; font-size: 13px; }
.cpage-breadcrumb a { color: var(--ink-muted); }
.cpage-breadcrumb a:hover { color: var(--seal); }
.cpage-sep { color: var(--line-strong); }
.cpage-crumb-current { color: var(--ink-soft); }

/* ---- hero ---- */
.course-hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 240px at 15% -20%, rgba(176, 58, 46, .10), transparent 60%),
    radial-gradient(700px 300px at 95% 0%, rgba(176, 58, 46, .07), transparent 55%);
  border-bottom: 1px solid var(--line);
}
.course-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(205, 191, 164, .10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(205, 191, 164, .10) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.5), transparent 70%);
}
.course-hero-inner { position: relative; padding: 56px 20px 54px; }
.course-hero-mark {
  position: absolute; top: 12px; right: 6px;
  font-family: var(--serif); font-size: clamp(120px, 18vw, 220px);
  font-weight: 700; line-height: 1; color: rgba(176, 58, 46, .06);
  user-select: none; pointer-events: none;
}
.course-hero-tags { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; position: relative; }
.cpage-tag {
  display: inline-block; padding: 4px 14px; border: 1px solid var(--line-strong);
  border-radius: 2px; background: var(--paper); color: var(--ink-soft);
  font-size: 12.5px; font-weight: 600; letter-spacing: .12em;
}
.cpage-tag-school { color: var(--seal); border-color: rgba(176, 58, 46, .4); background: var(--seal-soft); }
.cpage-tag-online { color: #7a5a12; border-color: rgba(160, 120, 20, .4); background: #f7f0dd; }
.course-hero-title {
  font-family: var(--serif); font-size: clamp(30px, 4.6vw, 46px);
  font-weight: 800; letter-spacing: .5px; line-height: 1.25; position: relative;
}
.course-hero-teacher { margin-top: 12px; color: var(--ink-muted); font-size: 15px; position: relative; }
.course-hero-teacher::before { content: "—"; margin-right: 8px; color: var(--seal); }
.course-hero-stats { display: flex; align-items: flex-end; gap: 40px; margin-top: 30px; flex-wrap: wrap; position: relative; }
.hero-stat { display: flex; flex-direction: column; }
.hero-stat b { font-family: var(--serif); font-size: clamp(30px, 4vw, 40px); font-weight: 800; color: var(--seal); line-height: 1; }
.hero-stat b::after { content: ""; display: block; width: 100%; height: 3px; background: var(--seal); margin-top: 8px; }
.hero-stat span { margin-top: 10px; color: var(--ink-soft); font-size: 13px; letter-spacing: .1em; }
.cpage-cta {
  display: inline-flex; align-items: center; gap: 12px; margin-left: auto;
  padding: 14px 26px; background: var(--seal); color: var(--paper);
  font-size: 16px; font-weight: 700; letter-spacing: .06em; border-radius: 2px;
  box-shadow: 0 10px 24px rgba(176, 58, 46, .28);
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}
.cpage-cta:hover { background: var(--seal-dark); color: var(--paper); transform: translateY(-2px); box-shadow: 0 14px 30px rgba(176, 58, 46, .34); }
.cta-arrow { font-size: 20px; line-height: 1; transition: transform .18s ease; }
.cpage-cta:hover .cta-arrow { transform: translateX(4px); }

/* ---- dossier layout ---- */
.course-dossier { display: grid; grid-template-columns: 1fr 320px; gap: 48px; padding: 48px 20px 64px; }
.dossier-block { margin-bottom: 44px; }
.dossier-title {
  display: flex; align-items: baseline; gap: 12px;
  font-family: var(--serif); font-size: 24px; font-weight: 800; letter-spacing: .3px;
  margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.dossier-num {
  font-size: 15px; font-weight: 700; color: var(--paper);
  background: var(--seal); padding: 2px 9px; border-radius: 2px; letter-spacing: .02em;
}
.dossier-desc { color: var(--ink-soft); white-space: pre-line; font-size: 15.5px; line-height: 1.9; }
.dossier-desc p { margin-bottom: 10px; }

/* ---- keywords ---- */
.dossier-keywords { display: flex; flex-wrap: wrap; gap: 10px; }
.dossier-kw {
  padding: 6px 16px; background: var(--paper-deep); border: 1px solid var(--line);
  border-radius: 999px; color: var(--ink-soft); font-size: 14px; transition: all .16s ease;
}
.dossier-kw:hover { border-color: var(--seal); color: var(--seal); transform: translateY(-1px); }

/* ---- knowledge tree (refined) ---- */
.ktree-wrap { border: 1px solid var(--line); background: rgba(255, 255, 255, .5); border-radius: 4px; padding: 18px 18px 10px; }
.ktree, .ktree-children { list-style: none; margin: 0; padding: 0; }
.ktree-children { padding-left: 24px; margin-left: 12px; border-left: 1px solid var(--line-strong); }
.ktree-node { margin: 0; }
.ktree-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px; border-radius: 3px; transition: background .14s ease;
}
.ktree-row:hover { background: var(--paper-deep); }
.ktree-row::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--seal); flex: none; opacity: .55; }
.ktree-name { color: var(--ink); font-size: 14.5px; }
.ktree-counts { display: inline-flex; gap: 6px; flex: none; }
.ktree-count { font-size: 12px; padding: 2px 10px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.ktree-ex { background: var(--seal-soft); color: var(--seal); }
.ktree-res { background: var(--paper-deep); color: var(--ink-soft); }

/* ---- aside ---- */
.dossier-aside { min-width: 0; }
.dossier-card-sticky { position: sticky; top: 76px; }
.dossier-card {
  border: 1px solid var(--line); background: rgba(255, 255, 255, .55);
  border-radius: 4px; padding: 22px 22px 14px;
}
.dossier-card-title {
  font-family: var(--serif); font-size: 17px; font-weight: 800; letter-spacing: .2px;
  padding-bottom: 10px; margin-bottom: 6px; border-bottom: 2px solid var(--seal);
  display: inline-block;
}
.dossier-card-title-sub { margin-top: 26px; }
.dossier-types { list-style: none; }
.dossier-types li { display: flex; align-items: center; justify-content: space-between; padding: 11px 2px; border-bottom: 1px dashed var(--line); }
.dossier-types a { color: var(--ink-soft); font-size: 14.5px; }
.dossier-types a:hover { color: var(--seal); }
.type-count { color: var(--seal); font-weight: 700; font-size: 14px; }
.type-all { border-bottom: 0 !important; }
.type-all a { color: var(--seal); font-weight: 600; }
.dossier-chapters { list-style: none; margin-top: 8px; }
.dossier-chapters li { padding: 7px 2px; color: var(--ink-soft); font-size: 14px; border-bottom: 1px dashed var(--line); }
.dossier-chapters li::before { content: "·"; color: var(--seal); font-weight: 700; margin-right: 8px; }

/* ---------------- 页面跳转加载遮罩 ---------------- */
.page-loading {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .92);
  opacity: 0; visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease;
}
.page-loading.show { opacity: 1; visibility: visible; }
.page-loading-inner { text-align: center; }
.page-loading-spinner {
  width: 46px; height: 46px; margin: 0 auto 16px;
  border: 4px solid rgba(47, 92, 227, .16);
  border-top-color: #2f5ce3;
  border-radius: 50%;
  animation: page-loading-spin .7s linear infinite;
}
@keyframes page-loading-spin { to { transform: rotate(360deg); } }
.page-loading p { color: #4b5563; font-size: 14px; letter-spacing: .04em; }

/* ---- reveal animation ---- */
.reveal { animation: cpageReveal .6s ease both; }
.reveal:nth-child(2) { animation-delay: .08s; }
.reveal:nth-child(3) { animation-delay: .16s; }
@keyframes cpageReveal {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .course-dossier { grid-template-columns: 1fr; gap: 32px; }
  .dossier-card-sticky { position: static; }
  .cpage-cta { margin-left: 0; }
  .course-hero-mark { opacity: .5; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .course-grid { grid-template-columns: repeat(2, 1fr); }
  .course-detail-body { grid-template-columns: 1fr; }
  .course-detail-aside { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 20px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .course-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 20px; }
  .footer-links { flex-direction: column; align-items: flex-start; gap: 8px; }
}