/* MBT-Learn 学习组件样式（课程页注入 + 首页/结业页共用） */
:root {
  --ml-primary: #1a5276;
  --ml-accent: #2980b9;
  --ml-ok: #1e8449;
  --ml-bad: #c0392b;
  --ml-border: #dee2e6;
}

.ml-widget {
  margin: 40px auto 24px;
  max-width: 1080px;
  padding: 0 16px;
  font-family: -apple-system, "Microsoft YaHei", "Segoe UI", sans-serif;
}
.ml-card {
  background: #fff;
  border: 1px solid var(--ml-border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(26, 82, 118, 0.08);
}
.ml-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ml-primary);
  margin: 0 0 10px;
}
.ml-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ml-status { font-size: 13px; color: #7f8c8d; margin-left: auto; }
.ml-status.done { color: var(--ml-ok); font-weight: 600; }

.ml-btn {
  display: inline-block;
  border: 1px solid var(--ml-accent);
  background: var(--ml-accent);
  color: #fff;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
}
.ml-btn:hover { background: #21618c; }
.ml-btn.ghost { background: #fff; color: var(--ml-accent); }
.ml-btn.small { padding: 4px 12px; font-size: 13px; }
.ml-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* 测验/账号 弹层（居中模态 + 遮罩模糊 + 入场动画） */
.ml-modal {
  position: fixed; inset: 0;
  background: rgba(16, 34, 52, 0.5);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: none; z-index: 9999;
  overflow: auto;
  padding: 24px 12px;
  align-items: flex-start; justify-content: center;
}
.ml-modal.open { display: flex; animation: ml-fade .18s ease; }
@keyframes ml-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ml-pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.ml-modal-box {
  width: 100%; max-width: 640px; margin: auto;
  background: #fff; border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 24px 60px rgba(16, 34, 52, 0.32);
  animation: ml-pop .24s cubic-bezier(.2, .7, .3, 1);
  font-family: -apple-system, "Microsoft YaHei", "Segoe UI", sans-serif;
}
.ml-q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ml-q-no { font-size: 12.5px; color: #7f8c8d; }
.ml-q-close { margin-left: auto; border: none; background: none; font-size: 20px; cursor: pointer; color: #95a5a6; }
.ml-q-stem { font-size: 15.5px; font-weight: 600; color: #2c3e50; line-height: 1.6; margin-bottom: 14px; }
.ml-q-type { font-size: 12px; color: var(--ml-accent); border: 1px solid var(--ml-accent); border-radius: 20px; padding: 1px 8px; }
.ml-opts { display: flex; flex-direction: column; gap: 8px; }
.ml-opt {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--ml-border); border-radius: 8px;
  padding: 10px 12px; cursor: pointer; font-size: 14px; line-height: 1.5;
}
.ml-opt:hover { border-color: var(--ml-accent); }
.ml-opt.right { border-color: var(--ml-ok); background: #eafaf1; }
.ml-opt.wrong { border-color: var(--ml-bad); background: #fdedec; }
.ml-opt.picked { border-width: 2px; }
.ml-opt input {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  flex: none; position: relative; box-sizing: border-box;
  width: 18px; height: 18px; margin: 2px 0 0; cursor: pointer;
  border: 2px solid var(--ml-border); background: #fff;
  transition: border-color .15s, background .15s;
}
.ml-opt input[type=radio] { border-radius: 50%; }
.ml-opt input[type=checkbox] { border-radius: 5px; }
.ml-opt:hover input { border-color: var(--ml-accent); }
/* 选中态：主题蓝；单选=蓝描边+中心实心点，多选=蓝底实心勾 */
.ml-opt input:checked { border-color: var(--ml-accent); }
.ml-opt input[type=radio]:checked { background: #fff; }
.ml-opt input[type=checkbox]:checked { background: var(--ml-accent); border-color: var(--ml-accent); }
/* 单选实心点几何（选中/正确/错误 三态共用，仅颜色不同；用 transform 居中兼容老浏览器） */
.ml-opt input[type=radio]:checked::after,
.ml-opt.right input[type=radio]::after,
.ml-opt.wrong input[type=radio]::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px;
  transform: translate(-50%, -50%); border-radius: 50%;
}
.ml-opt input[type=radio]:checked::after { background: var(--ml-accent); }
/* 多选勾几何（三态共用） */
.ml-opt input[type=checkbox]:checked::after,
.ml-opt.right input[type=checkbox]::after,
.ml-opt.wrong input[type=checkbox]::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 4px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
/* 练习判分覆盖（放在 :checked 之后，同特异度靠源码序取胜）：正确项绿、错选项红，未选中的正确答案也显点 */
.ml-opt.right input { border-color: var(--ml-ok); }
.ml-opt.right input[type=radio]::after { background: var(--ml-ok); }
.ml-opt.right input[type=checkbox] { background: var(--ml-ok); border-color: var(--ml-ok); }
.ml-opt.wrong input { border-color: var(--ml-bad); }
.ml-opt.wrong input[type=radio]::after { background: var(--ml-bad); }
.ml-opt.wrong input[type=checkbox] { background: var(--ml-bad); border-color: var(--ml-bad); }
/* 判分后 input 被 disabled，禁止浏览器默认置灰，保持实心点清晰 */
.ml-opt input:disabled { opacity: 1; cursor: default; }
.ml-feedback { margin-top: 12px; font-size: 13.5px; border-radius: 8px; padding: 10px 12px; display: none; line-height: 1.6; }
.ml-feedback.okk { display: block; background: #eafaf1; color: #145a32; }
.ml-feedback.bad { display: block; background: #fdedec; color: #922b21; }
.mq-actions { display: flex; gap: 10px; margin-top: 14px; justify-content: flex-end; }

/* 成绩小结 */
.ml-result { text-align: center; }
.ml-score { font-size: 42px; font-weight: 700; color: var(--ml-primary); margin: 10px 0 4px; }
.ml-score.pass { color: var(--ml-ok); }
.ml-result-sub { color: #7f8c8d; font-size: 13.5px; margin-bottom: 16px; }
.ml-wrongs { text-align: left; font-size: 13.5px; color: #2c3e50; margin: 10px 0; line-height: 1.8; }

/* CTA 条 */
.ml-cta {
  margin-top: 14px;
  background: #eef5fa;
  border-left: 4px solid var(--ml-accent);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  font-size: 13px; color: #2c3e50; line-height: 1.7;
}
.ml-cta a { color: var(--ml-accent); font-weight: 600; text-decoration: none; }

@media (max-width: 640px) {
  .ml-modal-box { padding: 16px 14px; }
  .ml-status { margin-left: 0; width: 100%; }
}

/* ---- Phase 2 云端账号组件（cloud.js / mc-* 类）：统一通栏顶栏，不再悬浮胶囊 ---- */
.mc-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 9000; display: flex; align-items: center; gap: 8px;
  flex-wrap: nowrap; min-height: 46px; box-sizing: border-box; padding: 7px 14px;
  background: rgba(255, 255, 255, 0.96); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(26, 82, 118, 0.12); box-shadow: 0 1px 6px rgba(26, 82, 118, 0.08); font-size: 13px; }
.mc-back { display: inline-flex; align-items: center; gap: 5px; color: var(--ml-primary); font-weight: 700; font-size: 13.5px; text-decoration: none; white-space: nowrap; padding: 5px 9px; border-radius: 999px; transition: background .15s, color .15s; }
.mc-back svg { flex: none; width: 19px; height: 19px; }
.mc-back:hover { color: var(--ml-accent); background: #eef3ff; }
/* ≤860（与抽屉/收起目录断点一致）：收起文字只剩房子图标，避让右侧账号控件；hover/focus 胶囊底保证纯图标仍读得出可点 */
@media (max-width: 860px) { .mc-back { padding: 5px 8px; } .mc-back .mc-back-t { display: none; } .mc-back svg { width: 21px; height: 21px; } }
.mc-spacer { flex: 1 1 auto; }
.mc-name { font-weight: 700; color: var(--ml-primary); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 姓名下拉收纳：顶栏单行的账号入口 + 点击展开的下拉菜单 */
.mc-user { position: relative; display: flex; align-items: center; }
.mc-chip { display: flex; align-items: center; gap: 8px; border: 0; background: rgba(26, 82, 118, .08); color: var(--ml-primary);
  border-radius: 999px; padding: 4px 12px 4px 5px; cursor: pointer; font-size: 13px; font-weight: 600; transition: background .15s; }
.mc-chip:hover { background: rgba(26, 82, 118, .15); }
.mc-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--ml-accent); color: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.mc-caret { font-size: 11px; opacity: .7; margin-left: -2px; }
.mc-menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 224px; background: #fff; display: none; flex-direction: column;
  border: 1px solid rgba(26, 82, 118, .12); border-radius: 12px; box-shadow: 0 12px 32px rgba(26, 82, 118, .18); padding: 6px; z-index: 9001; }
.mc-user.open .mc-menu { display: flex; }
.mc-menu-head { font-size: 12px; color: #7a8aa0; padding: 8px 12px 8px; border-bottom: 1px solid #eef2f7; margin-bottom: 4px; line-height: 1.4; }
.mc-menu-item { border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 8px; font-size: 14px; color: var(--ml-primary); cursor: pointer; transition: background .12s; }
.mc-menu-item:hover { background: #f1f5fa; }
.mc-menu-item.danger { color: #b3261e; }
.mc-menu-item.danger:hover { background: #fdeeec; }
.mc-menu-sep { height: 1px; background: #eef2f7; margin: 4px 6px; }
.mc-link { border: 0; background: var(--ml-accent); color: #fff; border-radius: 999px; padding: 7px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background .15s, transform .15s, box-shadow .15s; }
.mc-link:hover { background: #21618c; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26, 82, 118, 0.28); }
.mc-link:active { transform: none; }
.mc-link.ghost { background: #eef2f9; color: #43536e; }
.mc-link.ghost:hover { background: #e2e9f4; color: var(--ml-primary); box-shadow: none; }
.mc-close { position: absolute; top: 12px; right: 14px; border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: #93a1b7; width: 30px; height: 30px; border-radius: 50%; transition: background .15s, color .15s; }
.mc-close:hover { background: #f1f4f9; color: var(--ml-primary); }
.ml-modal-box { position: relative; }
.mc-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; max-width: 360px; }
.mc-form .mc-field { gap: 6px; }
.mc-form .mc-lab { font-size: 13px; font-weight: 600; color: #3b4a63; }
.mc-form input { width: 100%; box-sizing: border-box; padding: 11px 13px; border: 1.5px solid #d3dded; border-radius: 10px; font-size: 15px; color: var(--ml-primary); background: #fbfcfe;
  transition: border-color .15s, box-shadow .15s, background .15s; }
.mc-form input:focus { outline: none; border-color: var(--ml-accent); background: #fff; box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.16); }
.mc-form .ml-btn { width: 100%; padding: 12px; font-size: 15px; border-radius: 10px; margin-top: 2px; }
.mc-form .ml-btn.ghost { width: 100%; background: transparent; border: 0; color: var(--ml-accent); font-weight: 600; padding: 6px; font-size: 13.5px; }
.mc-form .ml-btn.ghost:hover { background: transparent; text-decoration: underline; }
.mc-msg { font-size: 13px; color: #6b7a93; margin: 2px 0 0; }
.mc-msg.err { color: #b3261e; font-weight: 600; background: #fdeeec; border-left: 3px solid #b3261e; padding: 8px 10px; border-radius: 0 6px 6px 0; }
.mc-exam-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.mc-timer { font-weight: 700; color: var(--ml-accent); white-space: nowrap; }
.mc-cert { margin-top: 10px; font-size: 14px; }
.mc-cert a { color: var(--ml-accent); font-weight: 600; }
@media (max-width: 640px) {
  .mc-name { max-width: 46vw; }
  .mc-form { max-width: none; }
}

/* ---- 首页品牌头部：顶栏做成深色主色条，左站名右登录，与下方蓝色标题呼应（白名单仅首页 body.mbt-home；曾用 :not(.mbt-course) 黑名单会误伤 overview/结业页） ---- */
body.mbt-home .mc-bar { min-height: 56px; padding: 10px 22px; background: var(--ml-primary); border-bottom: none;
  box-shadow: 0 2px 10px rgba(26, 82, 118, 0.28); -webkit-backdrop-filter: none; backdrop-filter: none; }
.mc-brand { color: #fff; font-weight: 700; font-size: 17px; letter-spacing: .3px; white-space: nowrap; }
body.mbt-home .mc-bar .mc-name { color: #fff; }
body.mbt-home .mc-bar .mc-link { background: #fff; color: var(--ml-primary); }
body.mbt-home .mc-bar .mc-link:hover { background: #eaf3fa; }
body.mbt-home .mc-bar .mc-link.ghost { background: rgba(255, 255, 255, 0.16); color: #fff; }
body.mbt-home .mc-bar .mc-link.ghost:hover { background: rgba(255, 255, 255, 0.28); color: #fff; }
/* 深色头部下姓名胶囊反色（白字、半透白底；头像白底主色字）；下拉菜单仍为白底浮层 */
body.mbt-home .mc-bar .mc-chip { background: rgba(255, 255, 255, 0.16); color: #fff; }
body.mbt-home .mc-bar .mc-chip:hover { background: rgba(255, 255, 255, 0.28); }
body.mbt-home .mc-bar .mc-avatar { background: #fff; color: var(--ml-primary); }
@media (max-width: 640px) {
  body.mbt-home .mc-bar { padding: 8px 14px; }
  .mc-brand { font-size: 15px; }
}

/* ---- 桌面侧栏显示/隐藏切换（cloud.js 驱动）：按钮默认隐藏，仅 ≥861 且有侧栏的课程页出现 ---- */
.mc-navtoggle { display: none; align-items: center; gap: 5px; flex: none; border: 1px solid rgba(26, 82, 118, .18);
  background: #fff; color: var(--ml-primary); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.mc-navtoggle:hover { background: #eef3ff; border-color: var(--ml-accent); }
.mc-navtoggle .mc-navtoggle-ico { font-size: 15px; line-height: 1; }
@media (min-width: 861px) {
  .mc-bar .mc-navtoggle { display: inline-flex; }
  .wrapper > nav { transition: width .18s ease, padding .18s ease; }
  /* 收起：侧栏宽度归零，main(flex:1) 自然吃满；用 width 而非 display 以保留过渡且不破坏 sticky */
  body.mbt-nav-collapsed .wrapper > nav { width: 0; padding: 0; overflow: hidden; }
}
@media (min-width: 861px) and (prefers-reduced-motion: reduce) {
  .wrapper > nav { transition: none; }
}
