* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #1f2329;
}
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: #fff; border-bottom: 1px solid #e6e8eb;
  position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 18px; font-weight: 600; }
nav a { margin-left: 18px; color: #4a6cf7; text-decoration: none; font-size: 15px; }
nav a:hover { text-decoration: underline; }

/* ---- 右上角 学生端/教师端 切换 ---- */
.mode-switch {
  display: inline-flex; margin-left: 18px; vertical-align: middle;
  border: 1px solid #d9dce0; border-radius: 999px; overflow: hidden;
}
.mode-switch a {
  margin: 0; padding: 5px 14px; font-size: 13px; color: #646a73;
  background: #fff; text-decoration: none; line-height: 1.4;
}
.mode-switch a:hover { text-decoration: none; background: #f5f6f8; }
.mode-switch a.active { background: #4a6cf7; color: #fff; }
.mode-switch a#sw-teacher.active { background: #2bb673; }
main { max-width: 760px; margin: 24px auto; padding: 0 16px; }
.card { background: #fff; border: 1px solid #e6e8eb; border-radius: 12px; padding: 22px; }
h2 { margin: 0 0 16px; font-size: 18px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
label { display: block; font-size: 13px; color: #646a73; margin: 12px 0 6px; }
input, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d9dce0; border-radius: 8px;
  font-size: 14px; font-family: inherit; outline: none;
}
input:focus, textarea:focus { border-color: #4a6cf7; }
textarea { resize: vertical; }
button {
  margin-top: 14px; padding: 10px 18px; border: none; border-radius: 8px;
  background: #4a6cf7; color: #fff; font-size: 14px; cursor: pointer;
}
button:hover { background: #3a5be0; }
button:disabled { background: #b9c2ee; cursor: not-allowed; }
.kp { background: #f0f4ff; border: 1px solid #d8e2ff; border-radius: 8px; padding: 14px; margin-top: 8px; }
.kp p { margin: 6px 0 0; line-height: 1.6; color: #2b2f36; }
.q { border: 1px solid #e6e8eb; border-radius: 8px; padding: 12px 14px; margin: 8px 0; }
.qh { font-weight: 500; }
.qa { color: #646a73; margin-top: 6px; line-height: 1.6; }
.hist { border: 1px solid #e6e8eb; border-radius: 8px; padding: 14px; margin: 10px 0; cursor: pointer; transition: .15s; }
.hist:hover { border-color: #4a6cf7; background: #fafbff; }
.ht { font-size: 15px; font-weight: 500; }
.hm { display: flex; gap: 16px; margin-top: 8px; font-size: 13px; color: #646a73; }
.social { margin: 16px 0; }
.cm { border-top: 1px solid #f0f1f3; padding: 10px 0; font-size: 14px; }
.cm b { color: #4a6cf7; }
.ct { color: #a0a4ab; font-size: 12px; margin-left: 8px; }
.cform { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.cform input { flex: 1; min-width: 140px; }
.cform button { margin-top: 0; white-space: nowrap; }
.up { max-width: 100%; border-radius: 8px; border: 1px solid #e6e8eb; margin-top: 8px; }
.hint { color: #646a73; font-size: 13px; margin-top: 12px; }
a { color: #4a6cf7; }

/* ---- 知识库统计条 ---- */
.stats { background: #eef2ff; border: 1px solid #dbe3ff; color: #3a4a8c; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.stats code { background: #fff; padding: 1px 6px; border-radius: 4px; border: 1px solid #dbe3ff; }

/* ---- 标签 / 徽章 ---- */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tag { display: inline-block; background: #4a6cf7; color: #fff; font-size: 12px;
  padding: 3px 9px; border-radius: 999px; line-height: 1.6; }
.tag-dim { background: #eef0f3; color: #646a73; }
.tag-src { background: #2bb673; }
.tag-hit { background: #ff8b3d; }
.tag-loc { background: #6b7b8d; }

/* ---- 知识点卡片正文 ---- */
.kpc { margin: 6px 0 0; line-height: 1.7; color: #2b2f36; white-space: pre-wrap; }

/* ---- 命中原题横幅 ---- */
.orig { background: #fff7e6; border: 1px solid #ffe0a3; border-radius: 8px;
  padding: 10px 14px; margin: 10px 0; font-size: 14px; color: #8a5a00; }

/* ---- 相关知识点 ---- */
.rel { margin: 12px 0; font-size: 14px; color: #2b2f36; }
.rel .tag { margin-left: 4px; }

/* ---- 题目元信息 / 题目正文 ---- */
.qmeta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.qtext { font-size: 16px; line-height: 1.7; color: #1f2329; margin: 0 0 8px; }

/* ---- 截图上传 / 识别 ---- */
.upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.upload input[type=file] { width: auto; max-width: 60%; }
.upload button { margin-top: 0; background: #2bb673; }
.upload button:hover { background: #229c61; }
.upload button:disabled { background: #a9d8c2; }
.qimg { max-width: 100%; border-radius: 8px; border: 1px solid #e6e8eb; margin: 8px 0; }
.thumb { max-width: 46px; max-height: 46px; border-radius: 6px; vertical-align: middle; margin-right: 8px; object-fit: cover; }

/* ---- 教师端 ---- */
.teacher-head { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-card { background: #eef7f1; border: 1px solid #d7e9de; border-radius: 8px; padding: 10px 18px; min-width: 90px; font-size: 12px; color: #667; }
.stat-card b { font-size: 22px; display: block; color: #1f9d61; }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 7px 0; }
.bar-name { width: 200px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; }
.bar-track { flex: 1; background: #f0f2f0; border-radius: 4px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #2bb673, #4ecb8b); border-radius: 4px; }
.bar-num { width: 96px; font-size: 12px; color: #667; text-align: right; flex-shrink: 0; }
table.trec { width: 100%; border-collapse: collapse; font-size: 13px; }
table.trec th, table.trec td { border-bottom: 1px solid #eee; padding: 8px 6px; text-align: left; }
table.trec th { color: #667; font-weight: 600; white-space: nowrap; }
table.trec tbody tr:hover { background: #f7fbf9; cursor: pointer; }
.qcell { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
