:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --primary: #2f6df6;
  --primary-d: #1f54d0;
  --accent: #ff8a3d;
  --green: #1faa59;
  --red: #e54d42;
  --text: #1f2733;
  --muted: #6b7785;
  --border: #e3e9f2;
  --shadow: 0 4px 18px rgba(40, 70, 130, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }

/* 顶部栏 */
.topbar {
  background: linear-gradient(120deg, var(--primary), #5b8dff);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 700; }
.topbar .sub { font-size: 13px; opacity: .9; }
.topbar .links a { color: #fff; margin-left: 16px; font-size: 14px; opacity: .95; }

/* 布局 */
.wrap { max-width: 1080px; margin: 22px auto; padding: 0 18px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
h2.section { font-size: 17px; margin: 4px 0 14px; }
.muted { color: var(--muted); font-size: 13px; }

/* 身份条 */
.identity {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  background: #eef3ff; border: 1px solid #d8e3ff; border-radius: 12px; padding: 12px 16px;
}
.identity input {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px; width: 160px;
}
.identity .who { font-weight: 600; }

/* 按钮 */
.btn {
  display: inline-block; border: none; cursor: pointer;
  background: var(--primary); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; transition: .15s;
}
.btn:hover { background: var(--primary-d); }
.btn.secondary { background: #eef1f6; color: var(--text); }
.btn.secondary:hover { background: #e2e7ef; }
.btn.accent { background: var(--accent); }
.btn.accent:hover { filter: brightness(.95); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 课时列表 */
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.lesson-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; cursor: pointer;
  background: #fff; transition: .15s; position: relative;
}
.lesson-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.lesson-card .no { font-size: 12px; color: var(--primary); font-weight: 700; }
.lesson-card .tt { font-weight: 700; margin: 4px 0; font-size: 15px; }
.lesson-card .lv { font-size: 12px; color: var(--muted); }
.lesson-card .done-badge {
  position: absolute; top: 10px; right: 12px; background: var(--green); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
}

/* 课件 */
.slide { border-left: 4px solid var(--primary); background: #f8faff; padding: 12px 16px; border-radius: 8px; margin-bottom: 12px; }
.slide h3 { margin: 0 0 6px; font-size: 15px; color: var(--primary-d); }
.slide pre, .code {
  background: #0f172a; color: #e6edf3; padding: 12px 14px; border-radius: 8px;
  font-family: "Consolas", "Courier New", monospace; font-size: 13px; white-space: pre-wrap; overflow-x: auto; margin: 6px 0;
}
.slide .body { white-space: pre-wrap; font-size: 14px; }

/* 任务单题目 */
.q { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; }
.q .head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.q .qno { background: var(--primary); color: #fff; border-radius: 6px; padding: 1px 9px; font-size: 13px; font-weight: 700; }
.q .tag { font-size: 12px; color: var(--muted); }
.q .tag.type-choice { color: #2f6df6; }
.q .tag.type-judge { color: #b56cf0; }
.q .tag.type-fill { color: #ff8a3d; }
.q .tag.type-output { color: #1faa59; }
.q .tag.type-complete { color: #e54d42; }
.q .stem { font-size: 15px; margin-bottom: 10px; white-space: pre-wrap; }
.q pre.stem-code { background: #0f172a; color: #e6edf3; padding: 10px 12px; border-radius: 8px; font-size: 13px; white-space: pre-wrap; }
.options { display: flex; flex-direction: column; gap: 8px; }
.opt {
  border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; cursor: pointer; font-size: 14px;
  display: flex; gap: 8px; align-items: center;
}
.opt:hover { background: #f3f7ff; }
.opt.selected { border-color: var(--primary); background: #eaf1ff; }
.opt.correct { border-color: var(--green); background: #e7f8ee; }
.opt.wrong { border-color: var(--red); background: #fdecea; }
.opt input { margin: 0; }
.q input.text, .q textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px;
  font-family: inherit;
}
.q textarea { min-height: 70px; resize: vertical; }

/* 解析/结果 */
.result-line { margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; }
.result-line.ok { background: #e7f8ee; border: 1px solid #bfe9cd; }
.result-line.no { background: #fdecea; border: 1px solid #f6c9c4; }
.result-line .label { font-weight: 700; }
.result-line .parsing { color: #43506b; margin-top: 4px; white-space: pre-wrap; }
.score-banner {
  text-align: center; font-size: 22px; font-weight: 800; padding: 14px; border-radius: 12px; margin-bottom: 14px;
}
.score-banner.good { background: #e7f8ee; color: var(--green); }
.score-banner.mid { background: #fff4e6; color: var(--accent); }
.score-banner.low { background: #fdecea; color: var(--red); }

/* 教师端表格 */
table.grades { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grades th, table.grades td { border: 1px solid var(--border); padding: 7px 9px; text-align: center; }
table.grades th { background: #f0f4fb; position: sticky; top: 0; }
table.grades td.name { text-align: left; font-weight: 600; }
table.grades td.total { font-weight: 700; background: #f7faff; }
.cell-done { background: #e7f8ee; color: var(--green); }
.cell-none { color: #c2cbd6; }
.summary-box { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.summary-box .item { background: #f0f4fb; border-radius: 10px; padding: 10px 16px; }
.summary-box .item .v { font-size: 22px; font-weight: 800; color: var(--primary); }
.summary-box .item .k { font-size: 12px; color: var(--muted); }
.login-box { max-width: 360px; margin: 60px auto; text-align: center; }
.login-box input { width: 100%; padding: 11px; margin: 8px 0; border: 1px solid var(--border); border-radius: 9px; font-size: 15px; }
.hidden { display: none !important; }
.tag {
  display: inline-block; font-size: 11px; color: #fff; background: var(--primary);
  border-radius: 6px; padding: 1px 8px; font-weight: 600; vertical-align: middle;
}
.sub-block { margin: 4px 0; }
.subsection { font-size: 15px; margin: 8px 0 10px; color: var(--primary-d); }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* 行内表单 */
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.inline-form input { padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px; }
.inline-form input[placeholder="班级名称 *"] { min-width: 150px; }

/* 名单 / 角色列表 */
.roster-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.roster-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: #fbfdff;
}
.roster-info { font-size: 14px; line-height: 1.5; }
.roster-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* 绑定班级勾选 */
.check-item {
  display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 7px 12px;
  border: 1px solid var(--border); border-radius: 9px; background: #fbfdff; cursor: pointer;
}
.check-item input { margin: 0; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2733; color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 14px; opacity: 0; transition: .25s; z-index: 99;
}
.toast.show { opacity: 1; }
.back-link { font-size: 13px; color: var(--muted); margin-bottom: 10px; display: inline-block; }
.tip { font-size: 12.5px; color: var(--muted); background: #fff8ec; border: 1px solid #ffe6bf; padding: 8px 12px; border-radius: 8px; margin: 8px 0; }
@media (max-width: 640px) {
  .lesson-grid { grid-template-columns: 1fr; }
  .identity input { width: 100%; }
}

/* 出勤点名 */
.attend-class { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; background: #fbfdff; }
.attend-head { font-size: 15px; margin-bottom: 10px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.attend-head b { font-size: 16px; color: var(--primary-d); }
.attend-count { font-size: 12px; color: var(--muted); font-weight: 600; }
.attend-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.attend-col-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; padding: 4px 10px; border-radius: 8px; }
.attend-col-title.ok { background: #e7f8ee; color: var(--green); }
.attend-col-title.no { background: #fdecea; color: var(--red); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600;
  border-radius: 20px; padding: 5px 12px;
}
.pill small { font-weight: 400; opacity: .8; font-size: 11px; }
.pill.ok { background: #e7f8ee; color: var(--green); border: 1px solid #bfe9cd; }
.pill.no { background: #fdecea; color: var(--red); border: 1px solid #f6c9c4; }
@media (max-width: 640px) {
  .attend-cols { grid-template-columns: 1fr; }
}
