/* ===== 课堂实时练习（前端原型，同一浏览器内联动） ===== */
:root {
  --cl-blue: #2563eb;
  --cl-green: #16a34a;
  --cl-amber: #d97706;
  --cl-red: #dc2626;
  --cl-line: #e6eaf1;
  --cl-sub: #7a8494;
}

/* 教师：发起按钮 */
.cl-launch {
  position: fixed; right: 22px; bottom: 86px; z-index: 900;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border: 0; border-radius: 24px;
  background: #1f2937; color: #fff; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 8px 22px rgba(20, 30, 50, .22); cursor: pointer;
}
.cl-launch:hover { background: #111827; }
.cl-launch .dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; }

/* 弹窗 */
.cl-mask {
  position: fixed; inset: 0; background: rgba(18, 24, 34, .45); z-index: 950;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.cl-dialog {
  width: 420px; max-width: 100%; background: #fff; border-radius: 14px;
  padding: 22px 22px 18px; box-shadow: 0 20px 60px rgba(15, 25, 40, .3);
}
.cl-dialog h3 { margin: 0 0 4px; font-size: 16px; }
.cl-dialog p.sub { margin: 0 0 16px; font-size: 12.5px; color: var(--cl-sub); }
.cl-field { margin-bottom: 14px; }
.cl-field label { display: block; font-size: 12.5px; color: #3f574b; margin-bottom: 6px; }
.cl-field select, .cl-field input {
  width: 100%; box-sizing: border-box; padding: 9px 10px; font-size: 13.5px;
  border: 1px solid var(--cl-line); border-radius: 8px; background: #fff;
}
.cl-times { display: flex; gap: 8px; flex-wrap: wrap; }
.cl-times button {
  padding: 7px 14px; border: 1px solid var(--cl-line); border-radius: 8px;
  background: #fff; font-size: 13px; cursor: pointer; color: #3b4351;
}
.cl-times button.on { border-color: var(--cl-blue); background: #eef4ff; color: var(--cl-blue); font-weight: 600; }
.cl-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

/* 通用按钮 */
.cl-btn {
  height: 32px; padding: 0 14px; border: 0; border-radius: 8px;
  background: var(--cl-blue); color: #fff; font-size: 13px; cursor: pointer;
}
.cl-btn:hover { background: #1d4ed8; }
.cl-btn.ghost { background: #fff; border: 1px solid var(--cl-line); color: #3b4351; }
.cl-btn.ghost:hover { background: #fafbfd; }

/* 教师：实时面板 */
.cl-panel {
  position: fixed; right: 22px; bottom: 76px; z-index: 1100;
  width: 380px; max-width: calc(100vw - 44px);
  display: flex; flex-direction: column;
  max-height: min(560px, calc(100vh - 110px));
  background: #fff; border-radius: 14px; border: 1px solid var(--cl-line);
  box-shadow: 0 16px 40px rgba(15, 25, 40, .18); overflow: hidden;
}
.cl-panel-head {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; flex: none;
  flex-wrap: wrap; row-gap: 4px;
  background: #f8fafc; border-bottom: 1px solid var(--cl-line);
}
.cl-panel-head .t { font-size: 13.5px; font-weight: 700; flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-panel-head .sec { font-size: 12px; color: var(--cl-sub); flex: none; }
.cl-panel-head .left {
  margin-left: auto; font-variant-numeric: tabular-nums; font-size: 14px;
  font-weight: 700; color: var(--cl-blue); flex: none;
}
.cl-close {
  flex: none; width: 26px; height: 26px; margin-left: 2px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: #94a3b8;
  font-size: 18px; line-height: 26px; text-align: center; cursor: pointer;
}
.cl-close:hover { background: #eaeff6; color: #475569; }
.cl-panel-filter {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px; flex: none;
  background: #fbfcfe; border-bottom: 1px solid var(--cl-line);
  font-size: 12px; color: var(--cl-sub);
}
.cl-panel-filter[hidden] { display: none; }
.cl-panel-filter .lab { flex: none; }
.cl-panel-filter select {
  flex: 1; min-width: 0; height: 26px; padding: 0 6px;
  border: 1px solid var(--cl-line); border-radius: 7px;
  background: #fff; color: #334155; font-size: 12px;
}
.cl-panel-body { max-height: 300px; min-height: 0; overflow-y: auto; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
.cl-row { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid #f4f6f9; font-size: 12.5px; }
.cl-row[data-open] { cursor: pointer; }
.cl-row[data-open]:hover { background: #f8fbff; }
.cl-row:last-child { border-bottom: 0; }
.cl-row .who { width: 62px; font-weight: 600; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-row .sql { flex: 1; min-width: 0; color: #5b6472; font-family: ui-monospace, Menlo, Consolas, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cl-row .sql:hover { color: var(--cl-blue); }
.cl-row .meta { color: #a2aab8; font-size: 11.5px; flex: none; }
.cl-row .mark { display: flex; gap: 4px; flex: none; }
.cl-row .mark button {
  width: 22px; height: 22px; border: 1px solid var(--cl-line); border-radius: 6px; background: #fff; cursor: pointer; font-size: 12px; line-height: 1;
}
.cl-row .mark .ok.on { background: #e8f7ee; border-color: #86efac; color: #15803d; }
.cl-row .mark .bad.on { background: #fdecec; border-color: #fca5a5; color: #b91c1c; }
.cl-empty { padding: 22px; text-align: center; color: var(--cl-sub); font-size: 12.5px; }
.cl-panel-foot { padding: 10px 14px; border-top: 1px solid var(--cl-line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: none; }
.cl-panel-foot .cl-btn { flex: none; }
.cl-panel-foot .hint { font-size: 11px; line-height: 1.35; color: var(--cl-sub); flex: 1 1 auto; text-align: right; }

/* 学生：底部答题条 */
.cl-student {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 900;
  width: 640px; max-width: calc(100vw - 24px);
  background: #fff; border-radius: 14px; border: 1px solid var(--cl-line);
  box-shadow: 0 16px 40px rgba(15, 25, 40, .18); overflow: hidden;
}
.cl-student-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: #eef4ff; }
.cl-student-head .t { font-size: 13.5px; font-weight: 700; color: #1e3a8a; }
.cl-student-head .left { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--cl-blue); }
.cl-student-body { padding: 12px 14px; }
.cl-student-body textarea {
  width: 100%; box-sizing: border-box; min-height: 76px; resize: vertical;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px;
  padding: 10px 12px; border: 1px solid var(--cl-line); border-radius: 8px;
}
.cl-student-body textarea:focus { outline: none; border-color: #bcd0f7; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.cl-student-foot { display: flex; align-items: center; gap: 10px; padding: 0 14px 12px; }
.cl-student-foot .msg { font-size: 12.5px; color: var(--cl-sub); }
.cl-student-foot .msg.ok { color: var(--cl-green); }

/* 收起后的小胶囊：还知道练习在跑，点一下重新打开面板 */
.cl-pill {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 1100; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 999px;
  border: 1px solid #c7d7f3; background: #fff; color: #1e3a8a;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  box-shadow: 0 10px 26px rgba(15, 25, 40, .2);
}
.cl-pill:hover { border-color: #9db9ea; }
.cl-pill i { width: 8px; height: 8px; border-radius: 50%; background: #2563eb; box-shadow: 0 0 0 4px rgba(37, 99, 235, .16); flex: none; }
.cl-pill .tm { font-variant-numeric: tabular-nums; color: #2563eb; font-size: 13px; }
/* 已经结束的那场：换个颜色，别让人以为还在计时 */
.cl-pill.done { border-color: #d8dee8; color: #3b4351; }
.cl-pill.done:hover { border-color: #b9c3d2; }
.cl-pill.done i { background: #94a3b8; box-shadow: 0 0 0 4px rgba(148, 163, 184, .18); }
.cl-pill.done .tm { color: #64748b; font-weight: 600; }

/* 限时：常用几档之外，可以自己填分钟数 */
.cl-times .cl-custom { display: inline-flex; align-items: center; gap: 6px; color: #6b7a8c; }
.cl-times .cl-custom input {
  width: 78px; padding: 7px 8px; font-size: 13px; text-align: center;
  border: 1px solid var(--cl-line); border-radius: 8px; background: #fff;
}
.cl-times .cl-custom input:focus { outline: none; border-color: #bcd0f7; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.cl-times .cl-custom em { font-style: normal; font-size: 12.5px; }

/* 点一个人看详情：整段 SQL 摊开，方便当面讲 */
.cl-detail { width: 620px; max-height: min(76vh, 640px); display: flex; flex-direction: column; }
.cl-detail h3 { display: flex; align-items: baseline; gap: 8px; }
.cl-detail-no { font-style: normal; font-size: 12.5px; font-weight: 400; color: var(--cl-sub); }
.cl-detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 10px; font-size: 12.5px; color: var(--cl-sub); }
.cl-detail-meta .st { padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f1f4f9; color: #4b5563; }
.cl-detail-meta .st.pass { background: #e8f7ee; color: #15803d; }
.cl-detail-meta .st.fail { background: #fdf3e0; color: #b45309; }
.cl-detail-meta .st.error { background: #fdecec; color: #b91c1c; }
.cl-detail-msg { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: #f7f9fc; font-size: 12.5px; line-height: 1.6; color: #3b4351; }
.cl-detail-sql {
  flex: 1 1 auto; min-height: 80px; overflow: auto; margin: 0 0 12px;
  padding: 12px; border: 1px solid var(--cl-line); border-radius: 10px; background: #fbfcfe;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word; color: #1f2937;
}

@media (max-width: 720px) {
  /* 手机/窄屏：当成底部卡片，铺满宽度、别顶到浏览器栏 */
  .cl-panel {
    left: 8px; right: 8px; width: auto; max-width: none;
    bottom: calc(8px + env(safe-area-inset-bottom));
    border-radius: 16px;
    max-height: min(62vh, calc(100vh - 96px));
  }
  .cl-panel-head { padding: 10px 12px; gap: 6px 8px; }
  .cl-panel-head .t { font-size: 13px; }
  .cl-panel-head .sec { font-size: 11.5px; }
  .cl-panel-head .left { font-size: 13.5px; }
  .cl-close { width: 28px; height: 28px; font-size: 20px; line-height: 28px; }
  .cl-panel-filter { padding: 6px 12px; }
  .cl-panel-body { max-height: none; }
  .cl-row { padding: 8px 12px; gap: 6px; }
  .cl-row .who { width: 88px; }
  .cl-row .mark { margin-left: auto; }
  .cl-row .sql { display: none; }        /* 窄屏放不下 SQL，点整行看全文 */
  .cl-row .meta { font-size: 11px; }
  .cl-panel-foot { padding: 8px 12px; gap: 6px; }
  .cl-panel-foot .hint { display: none; }
  .cl-panel-foot .cl-btn { flex: 1 1 auto; text-align: center; }
  .cl-pill { right: 12px; left: auto; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .cl-launch { right: 12px; bottom: 76px; }
  /* 学生答题条同理：铺满宽度，别露出半截 */
  .cl-student {
    left: 8px; right: 8px; width: auto; transform: none;
    bottom: calc(8px + env(safe-area-inset-bottom)); border-radius: 16px;
  }
  .cl-student-head { padding: 10px 12px; }
  .cl-student-body { padding: 10px 12px; }
  .cl-student-head .t { font-size: 13px; }
}

/* 练习框里的教师入口 */
.content .cl-inline{padding:7px 12px;border:1px solid #d97706;border-radius:6px;background:#fff;color:#b45309;font-size:13px;font-weight:600;cursor:pointer}
.content .cl-inline:hover{background:#fff8ec}

/* 真实判题结果：✓ 通过 / ✗ 没对上 / ! 报错 / — 没交 */
.cl-row .who { width: 104px; display: flex; flex-direction: column; line-height: 1.25; }
.cl-row .who i { font-style: normal; font-size: 11px; color: var(--cl-sub); font-weight: 400; }
.cl-row .mark .st {
  display: inline-block; width: 22px; height: 22px; line-height: 22px; text-align: center;
  border-radius: 6px; font-size: 12px; font-weight: 700; background: #f1f3f6; color: #9aa3b0;
}
.cl-row .mark .st.pass { background: #e8f7ee; color: #15803d; }
.cl-row .mark .st.fail { background: #fdf3e0; color: #b45309; }
.cl-row .mark .st.error { background: #fdecec; color: #b91c1c; }
.cl-row.is-none { opacity: .55; }
.cl-row .mark { display: flex; gap: 4px; flex: none; }

.cl-stu-status { margin-top: 8px; font-size: 12.5px; color: #5b6472; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.cl-stu-status .st { padding: 1px 8px; border-radius: 20px; font-size: 12px; background: #f1f3f6; color: #6b7280; }
.cl-stu-status .st.pass { background: #e8f7ee; color: #15803d; }
.cl-stu-status .st.fail { background: #fdf3e0; color: #b45309; }
.cl-stu-status .st.error { background: #fdecec; color: #b91c1c; }
.cl-stu-msg { flex: 1 1 100%; color: #8b95a3; }
.cl-stu-jump { display: inline-block; margin-top: 8px; font-size: 12.5px; color: var(--cl-blue); text-decoration: none; }
.cl-stu-jump:hover { text-decoration: underline; }
.cl-dim { color: #9aa3b0; }
.cl-student-foot .msg.bad { color: #b91c1c; }

.cl-toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(8px);
  background: rgba(24, 32, 44, .92); color: #fff; font-size: 13px; padding: 9px 16px;
  border-radius: 20px; opacity: 0; pointer-events: none; transition: all .18s; z-index: 1000;
}
.cl-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 练习框里的「展示答案」（教师） */
.content .answer-btn{margin-left:8px;padding:7px 12px;border:1px solid #9db3d4;border-radius:6px;background:#fff;color:#25507d;font-size:13px;font-weight:600;cursor:pointer}
.content .answer-btn:hover{background:#f3f7fd}
.content .answer-btn:disabled{opacity:.65;cursor:default}

/* 答案卡：先文字要点，再参考写法 */
.content .answer-block .answer-tip{margin:0 0 8px;padding:10px 12px;border:1px solid #d9e8de;border-radius:6px;background:#f7fbf9;font-size:14px;line-height:1.7}
.content .answer-block .answer-tip > :first-child{margin-top:0}
.content .answer-block .answer-tip > :last-child{margin-bottom:0}
.content .answer-block .answer-sub{margin:10px 0 4px;font-size:12.5px;color:#6b7a8c}

/* 工具栏顺序由 JS 控制：展示答案固定在最右 */
.content .practice-bar{gap:8px;flex-wrap:wrap}

/* 教师视图的工具栏：隐藏提示文字，按钮排成一行 */
.content .practice-bar.teacher-bar .practice-hint{display:none}
.content .practice-bar.teacher-bar{gap:8px}

/* 对答案：默认收起，点了才显示 */
.content .practice-block .block-tip{display:none}
.content .practice-block.show-tip .block-tip{display:block}
.content .tip-btn{padding:7px 12px;border:1px solid #bcd0c4;border-radius:6px;background:#fff;color:#2f6b4f;font-size:13px;font-weight:600;cursor:pointer}
.content .tip-btn:hover{background:#f3faf6}

/* 提示语会挤得按钮换行，收起来（占位文字里已经说了） */
.content .practice-bar .practice-hint{display:none}

/* ===== 课程页内联课堂练习：贴在发起的那道题下面 ===== */
.cl-live {
  margin: 22px 0 28px;
  border: 1px solid #dfe8e3;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 40, 30, .04);
  overflow: hidden;
  font-size: 13px;
}
.cl-live[data-state="running"] { border-color: #bfe3d2; box-shadow: 0 2px 16px rgba(62, 175, 124, .12); }
.cl-live-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 14px; background: #f3faf6; border-bottom: 1px solid #e3efe8;
}
.cl-live-tag {
  flex: none; font-size: 11px; font-weight: 600; color: #fff;
  background: #3eaf7c; border-radius: 999px; padding: 2px 8px; letter-spacing: .02em;
}
.cl-live[data-state="ended"] .cl-live-tag { background: #94a3b1; }
.cl-live-head .t { font-weight: 700; font-size: 14px; color: #22352b; }
.cl-live-head .sec { color: #7b8f84; font-size: 12px; }
.cl-live-head .spacer { flex: 1 1 auto; }
.cl-live-head .counts { font-size: 12.5px; color: #3f574b; font-variant-numeric: tabular-nums; }
.cl-live-head .left {
  min-width: 56px; text-align: center; font-variant-numeric: tabular-nums;
  color: #1f7a55; background: #e7f6ee; border: 1px solid #c9e9d9;
  border-radius: 999px; padding: 3px 9px; font-size: 12.5px; font-weight: 600;
}
.cl-live[data-state="ended"] .cl-live-head .left { color: #6b7a8c; background: #f2f5f7; border-color: #dfe6ec; }
.cl-live-actions { display: inline-flex; gap: 6px; flex: none; }
.cl-live-actions .cl-btn { padding: 5px 11px; font-size: 12.5px; }
.cl-live-filter {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 14px; border-bottom: 1px solid #eef4f0; background: #fbfdfc;
  font-size: 12.5px; color: #6b7a8c;
}
.cl-live-filter[hidden] { display: none; }
.cl-live-filter .lab { flex: none; }
.cl-live-filter select {
  padding: 4px 8px; border: 1px solid var(--cl-line); border-radius: 7px;
  font-size: 12.5px; background: #fff; color: #2b3644;
}
.cl-live-body { max-height: 340px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.cl-live-body .cl-row { padding: 9px 14px; }
.cl-live-foot { padding: 8px 14px; border-top: 1px solid #eef4f0; color: #8a9a91; font-size: 11.5px; }
.cl-live-hist { border-top: 1px solid #eaf1ed; }
.cl-live-hist > summary {
  cursor: pointer; padding: 9px 14px; font-size: 12.5px; color: #3f574b;
  user-select: none; list-style: none;
}
.cl-live-hist > summary::-webkit-details-marker { display: none; }
.cl-live-hist > summary::before { content: "▸ "; color: #9bb0a4; }
.cl-live-hist[open] > summary::before { content: "▾ "; }
.cl-live-hist > summary:hover { background: #f7fbf9; }
.cl-hist-list { max-height: 240px; overflow-y: auto; padding: 0 10px 10px; }
.cl-hist-item {
  display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left;
  padding: 7px 10px; border: 1px solid transparent; border-radius: 8px;
  background: none; cursor: pointer; font: inherit; color: #3b4a42;
}
.cl-hist-item:hover { background: #f4faf7; }
.cl-hist-item.on { background: #eaf7f0; border-color: #c9e9d9; }
.cl-hist-item .when { flex: none; font-variant-numeric: tabular-nums; color: #7b8f84; font-size: 12px; }
.cl-hist-item .sec { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.cl-hist-item .stat { flex: none; color: #6b7a8c; font-size: 12px; }
.cl-hist-item .st { flex: none; font-size: 11.5px; color: #8a9a91; }
.cl-hist-item.on .st { color: #1f7a55; }

@media (max-width: 640px) {
  .cl-live-head .sec { display: none; }
  .cl-live-head .counts { order: 5; }
  .cl-hist-item .stat { display: none; }
}

/* 内联卡片里的名单：名字和学号放一行，别挤成两行 */
/* 内联卡片里的名单：名字和学号放一行，别挤成两行、也别把学号截掉 */
.cl-live-body .cl-row .who { width: 170px; min-width: 170px; display: inline-flex; flex-direction: row; align-items: baseline; gap: 6px; overflow: visible; }
.cl-live-body .cl-row .who i { white-space: nowrap; flex: none; }
/* 历史列表底部：去教师台看全部 */
.cl-hist-all { display: block; margin: 8px 10px 2px; font-size: 12px; color: #3f6fa8; text-decoration: none; }
.cl-hist-all:hover { text-decoration: underline; }
/* style.css 里有一套 .content .cl-row（终端 ls 输出用的 grid），别串到课堂练习的名单上 */
.content .cl-live .cl-row {
  display: flex; align-items: center; width: auto; gap: 8px;
  grid-template-columns: none; padding: 9px 14px;
}
.content .cl-live .cl-row:last-child { border-bottom: 0; }

/* 卡片收起：只留抬头一行，名单/历史都藏起来 */
.cl-live.is-collapsed .cl-live-filter,
.cl-live.is-collapsed .cl-live-body,
.cl-live.is-collapsed .cl-live-foot,
.cl-live.is-collapsed .cl-live-hist { display: none; }
.cl-live.is-collapsed .cl-live-head { border-bottom: 0; }
.cl-live-toggle { flex: none; }

/* 课堂练习：答题时间内可以反复改 */
.cl-stu-hint { margin-top: 6px; font-size: 11.5px; line-height: 1.5; color: #8a9a91; }
