/* ==========================================================================
   深圳市易制毒化学品协会 · 会员培训系统  全站样式
   ========================================================================== */

:root {
  --c-primary: #185fa5;
  --c-primary-dark: #0c447c;
  --c-primary-light: #e6f1fb;
  --c-primary-soft: #f3f8fd;
  --c-teal: #0f6e56;
  --c-teal-light: #e1f5ee;
  --c-amber: #854f0b;
  --c-amber-light: #faeeda;
  --c-red: #a32d2d;
  --c-red-light: #fcebeb;
  --c-green: #3b6d11;
  --c-green-light: #eaf3de;

  --t-1: #1f2328;
  --t-2: #5b6472;
  --t-3: #8a93a0;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e2e6ec;
  --border-strong: #cfd6df;

  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 14px;

  --shadow-s: 0 1px 2px rgba(16, 32, 56, .06);
  --shadow: 0 4px 14px rgba(16, 32, 56, .08);
  --shadow-l: 0 12px 34px rgba(16, 32, 56, .12);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--t-1);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.4; }
h1 { font-size: 20px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }

.muted { color: var(--t-2); }
.tiny { font-size: 12px; }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.hidden { display: none !important; }
.mt0 { margin-top: 0 !important; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mt24 { margin-top: 24px; }
.mb0 { margin-bottom: 0 !important; }
.mb8 { margin-bottom: 8px; }
.mb16 { margin-bottom: 16px; }
.mb24 { margin-bottom: 24px; }

/* ---------------------------------------------------------------- 通用布局 */

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 860px; margin: 0 auto; padding: 0 20px; }
.row { display: flex; gap: 12px; align-items: center; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.row-wrap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
/* 考试页：左题面 + 右答题卡。答题卡要比一般侧栏宽，题号按钮才够大够看清 */
.exam-layout { grid-template-columns: minmax(0, 1fr) 336px; }

/* ---------------------------------------------------------------- 顶部导航 */

.topbar {
  background: linear-gradient(180deg, #0c447c 0%, #14548f 100%);
  color: #fff;
  box-shadow: var(--shadow);
}
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 62px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px; flex: none;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .3);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
}
.brand-text { min-width: 0; }
.brand-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11.5px; opacity: .78; white-space: nowrap; }
.topbar nav { display: flex; gap: 4px; margin-left: auto; }
.topbar nav a {
  color: rgba(255, 255, 255, .85); padding: 7px 13px; border-radius: 8px;
  font-size: 13.5px; text-decoration: none; white-space: nowrap;
}
.topbar nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; }
.topbar nav a.active { background: rgba(255, 255, 255, .2); color: #fff; font-weight: 500; }
.topbar-user { display: flex; align-items: center; gap: 10px; margin-left: 8px; font-size: 13px; }
.topbar-user .who { opacity: .9; }
.topbar-user .who b { font-weight: 600; }

/* ---------------------------------------------------------------- 卡片 */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
}
.card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  flex-wrap: wrap;
}
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 9px; }
.card-head .dot {
  width: 4px; height: 16px; border-radius: 2px; background: var(--c-primary); display: inline-block;
}
.card-body { padding: 20px; }
.card-body.tight { padding: 14px 20px; }
.card-body.flush { padding: 0; }

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-l); padding: 16px 18px; box-shadow: var(--shadow-s);
}
.stat .k { font-size: 12.5px; color: var(--t-2); margin-bottom: 6px; }
.stat .v { font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -.4px; }
.stat .u { font-size: 12.5px; color: var(--t-3); margin-left: 4px; font-weight: 400; }
.stat.accent .v { color: var(--c-primary); }
.stat.ok .v { color: var(--c-green); }
.stat.warn .v { color: var(--c-amber); }
.stat.bad .v { color: var(--c-red); }

/* ---------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 13.5px; font-family: inherit;
  border: 1px solid var(--border-strong); background: #fff; color: var(--t-1);
  cursor: pointer; white-space: nowrap; transition: .15s;
}
.btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn:disabled:hover { border-color: var(--border-strong); color: var(--t-1); }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color: #fff; }
.btn-teal { background: var(--c-teal); border-color: var(--c-teal); color: #fff; }
.btn-teal:hover { background: #0a5945; border-color: #0a5945; color: #fff; }
.btn-danger { color: var(--c-red); border-color: #ecc7c7; background: #fff; }
.btn-danger:hover { background: var(--c-red); border-color: var(--c-red); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { padding: 11px 26px; font-size: 15px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--c-primary-soft); }

/* ---------------------------------------------------------------- 表单 */

.field { margin-bottom: 15px; }
.field > label { display: block; font-size: 13px; color: var(--t-2); margin-bottom: 6px; }
.field .req { color: var(--c-red); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: 8px; background: #fff;
  color: var(--t-1); transition: .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(24, 95, 165, .12);
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
.input-sm { padding: 6px 10px; font-size: 13px; }
.hint { font-size: 12px; color: var(--t-3); margin-top: 5px; }
.err { font-size: 12.5px; color: var(--c-red); margin-top: 6px; }
/* 弹窗中的复选框行（新建培训期次时选择复制内容） */
.chk-line {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px 10px; border-radius: 8px; font-size: 13px; color: var(--t-1);
  line-height: 1.6; cursor: pointer;
}
.chk-line:hover { background: #f5f8fc; }
.chk-line input { margin-top: 3px; flex: none; width: 15px; height: 15px; accent-color: var(--c-primary); }
.chk-line b { font-weight: 600; }

.search-box { position: relative; }
.search-box .input { padding-left: 32px; }
.search-box::before {
  content: ""; position: absolute; left: 11px; top: 50%; width: 13px; height: 13px;
  margin-top: -7px; border: 1.6px solid var(--t-3); border-radius: 50%;
}
.search-box::after {
  content: ""; position: absolute; left: 22px; top: 50%; width: 6px; height: 1.6px;
  margin-top: 5px; background: var(--t-3); transform: rotate(45deg);
}

/* ---------------------------------------------------------------- 表格 */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; padding: 11px 14px; background: #f7f9fc; color: var(--t-2);
  font-weight: 500; font-size: 12.5px; border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.data td {
  padding: 11px 14px; border-bottom: 1px solid #eef1f5; vertical-align: middle;
}
table.data tbody tr:hover { background: #fafbfd; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 44px 20px; text-align: center; color: var(--t-3); font-size: 13.5px; }

/* ---------------------------------------------------------------- 徽标 */

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px;
  border-radius: 100px; font-size: 12px; line-height: 1.7; white-space: nowrap;
  border: 1px solid transparent;
}
.tag-blue { background: var(--c-primary-light); color: var(--c-primary-dark); }
.tag-teal { background: var(--c-teal-light); color: var(--c-teal); }
.tag-amber { background: var(--c-amber-light); color: var(--c-amber); }
.tag-red { background: var(--c-red-light); color: var(--c-red); }
.tag-green { background: var(--c-green-light); color: var(--c-green); }
.tag-gray { background: #eef1f5; color: var(--t-2); }
.tag-purple { background: #ede9fe; color: #6d28d9; }
.tag-slate { background: #e2e8f0; color: #334155; }

/* ---------------------------------------------------------------- 进度条 */

.bar { height: 7px; border-radius: 100px; background: #e9edf2; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 100px; background: var(--c-primary); transition: width .35s; }
.bar.teal > i { background: var(--c-teal); }
.bar.green > i { background: var(--c-green); }
.bar.amber > i { background: #ba7517; }

/* ---------------------------------------------------------------- 登录页 */

.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px 20px;
  background:
    radial-gradient(1100px 500px at 12% -12%, #e3eefb 0%, rgba(227, 238, 251, 0) 62%),
    radial-gradient(900px 460px at 92% 112%, #e2f2ec 0%, rgba(226, 242, 236, 0) 60%),
    var(--bg);
}
.login-box {
  width: 100%; max-width: 940px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-l);
  display: grid; grid-template-columns: 1.02fr 1fr; overflow: hidden;
}
.login-intro {
  padding: 42px 38px; color: #fff;
  background: linear-gradient(160deg, #0c447c 0%, #185fa5 58%, #1f7fae 100%);
  display: flex; flex-direction: column;
}
.login-intro h1 { font-size: 23px; margin-bottom: 12px; line-height: 1.45; }
.login-intro .lead { font-size: 13.5px; opacity: .9; line-height: 1.85; }
.login-intro ul { margin: 22px 0 0; padding: 0; list-style: none; }
.login-intro li {
  font-size: 13px; opacity: .95; padding: 7px 0 7px 22px; position: relative; line-height: 1.6;
}
.login-intro li::before {
  content: ""; position: absolute; left: 2px; top: 14px;
  width: 9px; height: 5px; border-left: 2px solid rgba(255, 255, 255, .95);
  border-bottom: 2px solid rgba(255, 255, 255, .95); transform: rotate(-45deg);
}
.login-intro .foot { margin-top: auto; padding-top: 26px; font-size: 12px; opacity: .62; }
.login-form { padding: 42px 38px; }
.login-form h2 { font-size: 18px; margin-bottom: 6px; }
/* 登录页的平台标识：同一网址自动识别设备 —— 手机进来看见「手机端学习平台」，
   电脑进来看见「电脑端学习平台」。两端是同一套数据，学习进度与证书通用。 */
.platform-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; font-size: 12.5px; color: var(--t-2); }
.tabs-mini { display: flex; gap: 4px; background: #f0f3f7; padding: 4px; border-radius: 9px; margin: 18px 0 22px; }
.tabs-mini button {
  flex: 1; padding: 7px 10px; border: none; background: transparent; border-radius: 7px;
  font-size: 13.5px; font-family: inherit; color: var(--t-2); cursor: pointer; transition: .15s;
}
.tabs-mini button.active { background: #fff; color: var(--c-primary); font-weight: 500; box-shadow: var(--shadow-s); }
.demo-tip {
  margin-top: 18px; padding: 12px 14px; background: var(--c-primary-soft);
  border: 1px dashed #bdd6ee; border-radius: 10px; font-size: 12.5px; color: var(--t-2); line-height: 1.9;
}
.demo-tip b { color: var(--t-1); }

/* ---------------------------------------------------------------- 侧栏布局（后台） */

.shell { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: calc(100vh - 62px); }
.side {
  background: var(--surface); border-right: 1px solid var(--border); padding: 14px 12px;
}
.side .grp { font-size: 11.5px; color: var(--t-3); padding: 14px 10px 6px; letter-spacing: .4px; }
.side a {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px;
  color: var(--t-1); font-size: 13.5px; text-decoration: none; margin-bottom: 2px; cursor: pointer;
}
.side a:hover { background: #f3f6fa; text-decoration: none; }
.side a.active { background: var(--c-primary-light); color: var(--c-primary-dark); font-weight: 500; }
.side a .ic {
  width: 17px; height: 17px; flex: none; border-radius: 4px; border: 1.6px solid currentColor;
  opacity: .6;
}
.side a .badge {
  margin-left: auto; font-size: 11.5px; background: #eef1f5; color: var(--t-2);
  padding: 1px 7px; border-radius: 100px;
}
.main { padding: 22px 24px 60px; min-width: 0; }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 19px; margin-bottom: 4px; }
.page-head p { color: var(--t-2); font-size: 13px; margin: 0; }
.section { margin-bottom: 20px; }

/* ---------------------------------------------------------------- 学员端 */

.hero {
  background: linear-gradient(160deg, #0c447c 0%, #185fa5 62%, #1f7fae 100%);
  color: #fff; padding: 30px 0 34px;
}
.hero h1 { font-size: 22px; margin-bottom: 8px; }
.hero p { font-size: 13.5px; opacity: .9; margin: 0; }
.hero .chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero .chip {
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25);
  padding: 8px 14px; border-radius: 9px; font-size: 12.5px; line-height: 1.5;
}
.hero .chip b { display: block; font-size: 18px; font-weight: 600; margin-top: 2px; }

.steps { display: flex; gap: 0; margin: 4px 0 20px; }
.step { flex: 1; text-align: center; position: relative; padding: 0 6px; }
.step::after {
  content: ""; position: absolute; top: 15px; left: 50%; width: 100%; height: 2px;
  background: #e2e6ec; z-index: 0;
}
.step:last-child::after { display: none; }
.step .n {
  width: 30px; height: 30px; border-radius: 50%; background: #e9edf2; color: var(--t-2);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 8px;
  font-size: 13.5px; font-weight: 600; position: relative; z-index: 1;
  border: 2px solid var(--surface);
}
.step.done .n { background: var(--c-green); color: #fff; }
.step.cur .n { background: var(--c-primary); color: #fff; }
.step .t { font-size: 12.5px; color: var(--t-2); }
.step.done .t, .step.cur .t { color: var(--t-1); font-weight: 500; }

/* 首页：左目录 + 右内容（避免首页一条长龙） */

.home-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.home-side {
  position: sticky;
  top: 16px;   /* 顶栏会随页面滚走，故只留四周留白 */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-s);
  padding: 12px 10px 14px;
}
.home-side .hd {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--t-3); letter-spacing: .3px;
  padding: 4px 10px 10px;
}
.home-side .hd b { color: var(--c-primary); font-weight: 600; font-size: 13px; }
.home-side a.nv {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 8px; margin-bottom: 2px;
  color: var(--t-1); font-size: 13.5px; text-decoration: none;
}
.home-side a.nv:hover { background: #f3f6fa; text-decoration: none; }
.home-side a.nv.active { background: var(--c-primary-light); color: var(--c-primary-dark); font-weight: 500; }
.home-side a.nv .ic { width: 16px; height: 16px; flex: none; opacity: .7; }
.home-side a.nv.active .ic { opacity: 1; }
.home-side a.nv .bd {
  margin-left: auto; flex: none; font-size: 11.5px; background: #eef1f5; color: var(--t-2);
  padding: 1px 7px; border-radius: 100px; white-space: nowrap;
}
.home-side a.nv.active .bd { background: #fff; color: var(--c-primary-dark); }
.home-side a.nv .bd.ok { background: var(--c-green-light); color: var(--c-green); }
.home-side a.nv .bd.warn { background: var(--c-amber-light); color: var(--c-amber); }
.home-side a.nv .bd.wait { background: #eef1f5; color: var(--t-3); }
.home-side .sep { height: 1px; background: var(--border); margin: 9px 10px; }
.home-side .tip { font-size: 11.5px; color: var(--t-3); line-height: 1.7; padding: 10px 10px 0; }
/* 目录顶部的“当前培训期次”提示：新一期培训上线后学员据此判断是否需要重学 */
.batch-tip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin: 0 0 8px; border-radius: 8px;
  background: var(--c-primary-light); color: var(--c-primary-dark);
  font-size: 11.5px; line-height: 1.45;
}
.batch-tip .ic { width: 15px; height: 15px; flex: none; opacity: .8; }
.batch-tip b { font-size: 12.5px; font-weight: 600; }
.home-main { min-width: 0; }
.home-main > .card:last-child, .home-main > .section:last-child { margin-bottom: 0; }

.video-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: #fff;
  transition: .15s;
}
.video-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-s); }
.video-item.locked { opacity: .62; background: #fafbfd; }
.video-item .idx {
  width: 30px; height: 30px; flex: none; border-radius: 8px; background: #f0f3f7;
  color: var(--t-2); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.video-item.done .idx { background: var(--c-green-light); color: var(--c-green); }
.video-item.cur .idx { background: var(--c-primary-light); color: var(--c-primary); }
.video-item .meta { flex: 1; min-width: 0; }
.video-item .meta .tt { font-size: 14px; font-weight: 500; margin-bottom: 3px; }
.video-item .meta .sb { font-size: 12.5px; color: var(--t-2); }

.player { background: #10202f; border-radius: var(--radius); overflow: hidden; }
.player .stage {
  position: relative; aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .5); font-size: 13px; background: #0d1a26;
}
.player .stage video { width: 100%; height: 100%; display: block; background: #000; }
.player .stage .placeholder { text-align: center; padding: 20px; }
.player .stage .placeholder .big { font-size: 15px; color: rgba(255, 255, 255, .78); margin-bottom: 6px; }
.player .bar-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: #17293a;
}
.player .play-btn {
  width: 32px; height: 32px; flex: none; border-radius: 50%; border: none; cursor: pointer;
  background: var(--c-primary); color: #fff; font-size: 12px; display: flex;
  align-items: center; justify-content: center; font-family: inherit;
}
.player .play-btn:hover { background: #1f7fae; }
.player .track {
  flex: 1; height: 5px; border-radius: 100px; background: rgba(255, 255, 255, .18);
  position: relative; cursor: not-allowed;
}
.player .track > i {
  position: absolute; inset: 0 auto 0 0; border-radius: 100px; background: #5dcaf5; width: 0;
}
.player .time { color: rgba(255, 255, 255, .8); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.player .lock-hint { color: rgba(255, 255, 255, .55); font-size: 12px; display: flex; align-items: center; gap: 5px; }

/* 考试 */
.q-card { padding: 20px 22px; }
.q-stem { font-size: 15px; font-weight: 500; line-height: 1.7; margin-bottom: 16px; }
.q-stem .qn { color: var(--c-primary); margin-right: 6px; }
.opt {
  display: flex; align-items: flex-start; gap: 11px; padding: 12px 15px; margin-bottom: 9px;
  border: 1px solid var(--border); border-radius: 9px; cursor: pointer; transition: .13s;
  background: #fff; font-size: 14px; line-height: 1.6;
}
.opt:hover { border-color: var(--c-primary); background: var(--c-primary-soft); }
.opt.sel { border-color: var(--c-primary); background: var(--c-primary-light); }
.opt .k {
  width: 22px; height: 22px; flex: none; border-radius: 50%; background: #f0f3f7;
  color: var(--t-2); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; margin-top: 1px;
}
.opt.sel .k { background: var(--c-primary); color: #fff; }
.opt .txt { flex: 1; min-width: 0; }
.opt.right { border-color: #b6d59a; background: var(--c-green-light); }
.opt.right .k { background: var(--c-green); color: #fff; }
.opt.wrong { border-color: #e8bcbc; background: var(--c-red-light); }
.opt.wrong .k { background: var(--c-red); color: #fff; }

/* 答题卡：题号按钮按容器宽度自动铺满，最小 44px（原为固定 10 列，实际每格只有 15px
   左右，视力一般的从业人员很难看清，故改为自适应 + 放大字号） */
.answer-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.answer-sheet button {
  aspect-ratio: 1; min-height: 44px; border-radius: 9px; border: 1px solid var(--border);
  background: #fff; font-size: 15px; font-weight: 500; font-family: inherit;
  cursor: pointer; color: var(--t-2); padding: 0; transition: .13s;
}
.answer-sheet button:hover { border-color: var(--c-primary); background: var(--c-primary-soft); }
.answer-sheet button.answered { background: var(--c-primary-light); border-color: #a9c8e8; color: var(--c-primary-dark); font-weight: 600; }
.answer-sheet button.cur { outline: 2px solid var(--c-primary); outline-offset: 1px; }
.answer-sheet button.cur.answered { background: var(--c-primary-light); }

/* 答题卡图例与提示 */
.sheet-legend { display: flex; flex-wrap: wrap; gap: 9px 18px; margin-bottom: 13px; font-size: 13.5px; color: var(--t-2); }
.sheet-legend span { display: inline-flex; align-items: center; gap: 7px; }
.sheet-legend i { width: 15px; height: 15px; border-radius: 5px; border: 1px solid var(--border); background: #fff; display: inline-block; }
.sheet-legend i.done { background: var(--c-primary-light); border-color: #a9c8e8; }
.sheet-legend i.cur { outline: 2px solid var(--c-primary); outline-offset: 1px; }
.sheet-count { font-size: 14px; font-weight: 600; }
.sheet-count b { color: var(--c-primary-dark); }
.sheet-count .todo-n { color: var(--c-amber); }

/* 未答题号（交卷拦截弹窗里可点击跳转） */
.todo-tags { display: flex; flex-wrap: wrap; gap: 9px; max-height: 216px; overflow-y: auto; }
.todo-tags button {
  min-width: 46px; height: 36px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; font-family: inherit; font-size: 14px; font-weight: 500;
  color: var(--t-1); cursor: pointer; padding: 0 10px;
}
.todo-tags button:hover { border-color: var(--c-primary); background: var(--c-primary-soft); color: var(--c-primary-dark); }

.score-ring {
  width: 132px; height: 132px; border-radius: 50%; margin: 0 auto 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 9px solid var(--c-green); color: var(--c-green);
}
.score-ring.fail { border-color: var(--c-red); color: var(--c-red); }
.score-ring .n { font-size: 38px; font-weight: 600; line-height: 1; letter-spacing: -1px; }
.score-ring .l { font-size: 12.5px; opacity: .8; margin-top: 3px; }

/* 证书：自由画布版面（2026-09 定稿 → 2026-09-21 改为**横向** + 自由定位）
   · A4 横向（297 × 210）：宽屏按 A4 实宽显示，窄屏整体缩小（可横向滚动）；
   · 所有元素（文字区块 / 徽标 / 公章 / 自定义文本框）都是**绝对定位的框**，
     left / top / width 由 ui.js 的 certElStyle() 写成行内百分比；
     默认坐标在 ui.js 的 CERT_EL_DEFAULT（横向 / 纵向各一套）；
   · 下面每条规则里的字号 / 颜色 / 对齐就是**默认外观**：后台没调过的项走这里，
     调过的项由行内样式覆盖（样式表仍是默认外观的唯一来源）。
   · 位置、宽度、字号、对齐、颜色都可以在后台直接拖动 / 修改，还能删除与新增。 */
.cert {
  background: #fff; border: 1px solid #d8d2c2; border-radius: 6px; padding: 8px;
  box-shadow: var(--shadow); width: 100%; max-width: 1120px; margin: 0 auto;
  overflow: hidden;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.cert-inner {
  border: 2px solid #a8894f; border-radius: 3px; padding: 0;
  position: relative; overflow: hidden;
  aspect-ratio: 297 / 210;   /* A4 横向比例（默认）—— 证书整体始终是 A4 形 */
  background:
    radial-gradient(760px 320px at 50% 0%, #fdf8ec 0%, rgba(253, 248, 236, 0) 72%),
    #fffdf8;
}
/* 后台把页面方向切成纵向时，内页跟着变成竖版比例 */
.cert-portrait .cert-inner { aspect-ratio: 210 / 297; }
.cert-inner::before {
  content: ""; position: absolute; inset: 7px; border: 1px solid #d9c48f; border-radius: 2px; pointer-events: none;
  z-index: 3;   /* 内框线压在图片水印与正文之上，保证边框始终清晰 */
}
/* 画布上的每个元素都是绝对定位的框，内容在 .ce-block 里 */
.cert-inner .cert-el { position: absolute; z-index: 1; }
.cert-inner .cert-el > .ce-block { position: relative; }

.cert-inner .ctitle {
  font-weight: 600; font-size: 40px; letter-spacing: 14px; line-height: 1.4;
  color: #7a5c22; text-align: center;
}
.cert-inner .cert-sub {
  font-size: 15px; letter-spacing: 6px; line-height: 1.6; color: #a08a5e; text-align: center;
}
/* 正文为选填：后台填写证书正文时才渲染这一块；默认不显示（协会定稿只留编号与有效期） */
.cert-inner .body {
  font-size: 15.5px; line-height: 2.1; color: #3b3225; text-indent: 2em;
}
.cert-inner .body u {
  text-decoration: none; border-bottom: 1px solid #b9a06a; padding: 0 9px; font-weight: 500;
  color: #2f281c;
}
/* 信息栏：默认「证书编号 + 有效期」两行居中；内容可在后台直接改 */
.cert-inner .rows {
  font-size: 15px; line-height: 2.2; letter-spacing: 1px; color: #4a4132; text-align: center;
}
/* 落款：默认「协会名称 + 日期」两行；协会名称加粗描金 */
.cert-inner .sign {
  font-size: 15px; line-height: 2.1; color: #4a4132; text-align: right;
}
.cert-inner .cert-foot {
  font-size: 11.5px; letter-spacing: .5px; line-height: 1.6; color: #a08a5e; text-align: center;
}
/* 后台「新增文本框」加的独立文字块 */
.cert-inner .cert-box {
  font-size: 15px; line-height: 1.8; color: #3b3225; text-align: left;
}

/* 协会公章：**独立元素**（可拖动 / 可删除，不再依附在落款行内）。
   上传了公章图片就用图片，否则画文字印章。
   ⚠ 正片叠底（multiply）必须写在 .cert-seal 这一层：
   .cert-el 自带 z-index 会创建堆叠上下文，写在里面的 .seal-img 上只能跟
   公章自己的透明背景混合 —— 盖在落款文字上会把字完全遮住（2026-09-21 实测）。
   写在 frame 层则与整张证书纸面混合：白底透出、红章压字但字仍可见。 */
.cert-inner .cert-seal { z-index: 2; mix-blend-mode: multiply; }
.cert-inner .cert-seal .seal-text {
  width: 100%; aspect-ratio: 1 / 1; border-radius: 50%;
  border: 3px solid rgba(186, 44, 44, .55); color: rgba(186, 44, 44, .68);
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 11.5px; line-height: 1.45; letter-spacing: .5px; font-weight: 600;
  transform: rotate(-11deg);
}
.cert-inner .cert-seal .seal-img {
  width: 100%; height: auto; display: block;
}

/* 协会徽标（协会图像）：2026-09-21 协会定稿 —— 不再放顶部徽标，
   改为**整页浅色水印**：默认坐标在证书中部、极低不透明度、衬在所有文字下方。
   编辑画布里提高不透明度（看得见、抓得住），打印 / 学员端仍是浅水印。 */
.cert-inner .cert-badge { z-index: 0; }
.cert-inner .cert-badge > .ce-block > img {
  width: 100%; height: auto; display: block;
  opacity: .12; mix-blend-mode: multiply;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.cert-editing .cert-badge > .ce-block > img { opacity: .38; }
/* 未上传边框底图时的旧版行为：协会图像作整页浅色水印（不可拖动） */
.cert-inner .cert-logo {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: 2px;
  display: flex; align-items: center; justify-content: center; z-index: 0;
}
.cert-inner .cert-logo img { width: 100%; height: 100%; object-fit: contain; opacity: .085; }

/* 协会模板版式：金色花边整页衬底（上传「证书边框底图」后启用） */
.cert-inner .cert-border {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.cert-inner .cert-border img {
  width: 100%; height: 100%; object-fit: fill; display: block;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.cert-has-border .cert-inner { border: none; background: #fff; }
.cert-has-border .cert-inner::before { display: none; } /* 花边已含边框，系统双线让位 */

/* ------------------------------------------------ 证书编辑器（Word 式在线编辑）

   后台「证书模板」→ 点证书上的文字直接改，选中文字用工具栏排版。
   画布用 zoom 把 A4 整页缩到面板里（与 Word 的显示比例同理）：
   版式比例、字号关系都跟真证书一致，看到的即学员拿到的。 */
.ce-toolbar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 8px 10px; margin-bottom: 12px; border: 1px solid var(--border);
  border-radius: 10px; background: #fbfcfe; position: sticky; top: 0; z-index: 6;
}
.ce-tb { display: flex; gap: 4px; align-items: center; padding-right: 8px; border-right: 1px solid var(--border); }
.ce-tb:last-child { border-right: none; padding-right: 0; }
.ce-tb .lbl { font-size: 12px; color: var(--t-3); }
.ce-btn {
  min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--border-strong);
  background: #fff; border-radius: 7px; font-size: 13px; cursor: pointer;
  font-family: inherit; color: var(--t-1); line-height: 1;
}
.ce-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.ce-btn.on { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary); }
.ce-btn.b { font-weight: 700; }
.ce-btn.i { font-style: italic; font-family: Georgia, serif; }
.ce-btn.u { text-decoration: underline; }
.ce-num { min-width: 30px; text-align: center; font-size: 12.5px; color: var(--t-2); font-variant-numeric: tabular-nums; }
.ce-main { display: grid; grid-template-columns: minmax(0, 1fr) 318px; gap: 16px; align-items: start; }
.ce-canvas {
  background: #eef1f6; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 10px; max-height: 60vh; overflow: auto;
}
/* 画布里的证书按 A4 实宽渲染后整体缩放（--ce-zoom 由页面按面板宽度设置） */
.ce-canvas .cert { width: 1120px; max-width: none; margin: 0 auto; overflow: visible; zoom: var(--ce-zoom, .58); }
.ce-side { display: flex; flex-direction: column; max-height: 60vh; overflow: auto; padding-right: 2px; }
.ce-side .field { margin-bottom: 12px; }
.ce-tip { font-size: 12px; color: var(--t-3); line-height: 1.7; }

/* ---- 自由画布：每个元素都是可选中 / 可拖动 / 可删除的「框」 ---- */
/* 元素内容：移上去提示「这里能改」，聚焦时高亮 */
.cert-editing .ce-block { border-radius: 3px; outline: 1px dashed transparent; transition: outline-color .12s; }
.cert-editing .ce-block:hover { outline-color: rgba(22, 104, 220, .42); }
.cert-editing .ce-block:focus {
  outline: 2px solid var(--c-primary); outline-offset: 3px; background: rgba(22, 104, 220, .045);
}
/* 空元素：给一句灰字提示（只出现在编辑器里，不会被打进证书） */
.cert-editing .ce-block[data-ph]:empty::before {
  content: attr(data-ph); color: #c3b9a6; font-style: italic; letter-spacing: 0; text-indent: 0;
}
/* 元素外框：被选中时亮起来，方便看清「拖动的是哪一块」 */
.cert-editing .ce-frame { outline: 1px dashed rgba(154, 133, 87, .55); outline-offset: 2px; }
.cert-editing .ce-frame:hover { outline-color: rgba(22, 104, 220, .55); cursor: default; }
.cert-editing .ce-frame[data-sel] {
  outline: 2px solid var(--c-primary); outline-offset: 2px;
  background: rgba(22, 104, 220, .035);
}
/* 编辑画布不裁纸外的内容：元素被拖到版面外时仍然看得见、抓得住 ——
   否则一旦拖出去就被 overflow 裁掉，连手柄都点不到，再也拖不回来。 */
.cert-editing .cert-inner { overflow: visible; }
/* 三个手柄：⠿ 拖动移动、◢ 拖动改宽度、✕ 删除（选中或光标进入时出现） */
.ce-handle {
  position: absolute; z-index: 5; display: none; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 5px; font-size: 12px; line-height: 1;
  border: 1px solid #b9c4d2; background: #fff; color: #46536a; cursor: pointer;
  box-shadow: 0 1px 3px rgba(16, 28, 44, .18); user-select: none; font-family: inherit;
}
.ce-frame[data-sel] > .ce-handle, .ce-frame > .ce-block:focus ~ .ce-handle { display: flex; }
.ce-drag { left: -11px; top: -11px; cursor: move; }
.ce-grip { right: -11px; bottom: -11px; cursor: ew-resize; }
.ce-del { right: -11px; top: -11px; color: #a02c2c; border-color: #e3bcbc; }
.ce-del:hover { background: #fdeeee; }
.ce-handle:hover { border-color: var(--c-primary); color: var(--c-primary); }
/* 拖动 / 缩放时的光标与禁选，避免拖出选区来 */
.ce-canvas.ce-dragging, .ce-canvas.ce-dragging * { cursor: move !important; user-select: none !important; }
.ce-canvas.ce-resizing, .ce-canvas.ce-resizing * { cursor: ew-resize !important; user-select: none !important; }
/* 工具栏里的小数字框（位置 X / Y / 宽） */
.ce-num-in {
  width: 60px; height: 30px; padding: 0 6px; font-size: 12.5px; text-align: center;
  border: 1px solid var(--border-strong); border-radius: 7px; background: #fff;
  color: var(--t-1); font-family: inherit;
}
.ce-num-in:focus { outline: none; border-color: var(--c-primary); }
/* 工具栏「开关型」按钮（示例数据预览）：用 data-on 标记，不用 class ——
   自检的 DOM 桩里 classList 是空实现，属性才读得出来。 */
.ce-btn[data-on] { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.ce-btn[data-on]:hover { color: #fff; }

/* ---------------------------------------------------------------- 弹层 */

.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 28, 44, .45); z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: var(--radius-l); box-shadow: var(--shadow-l);
  width: 100%; max-width: 560px; max-height: 88vh; display: flex; flex-direction: column;
  animation: pop .16s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; } }
.modal.wide { max-width: 860px; }
.modal.xwide { max-width: 1040px; }
.modal-head {
  padding: 16px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px 22px; overflow: auto; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--border); display: flex;
  justify-content: flex-end; gap: 10px; flex-wrap: wrap;
}
.x-btn {
  border: none; background: transparent; font-size: 20px; line-height: 1; color: var(--t-3);
  cursor: pointer; padding: 2px 6px; border-radius: 6px; font-family: inherit;
}
.x-btn:hover { background: #f0f3f7; color: var(--t-1); }

/* 强制弹窗（视频学习中途答题）：不答对不能关闭 —— 点遮罩 / 按 Esc 都无效，
   连关闭按钮也不渲染；顶部加一道主色条，让「这是必须完成的关卡」一眼可见。 */
.modal-locked { border-top: 3px solid var(--c-primary); }
.modal-locked .modal-head { padding-right: 22px; }
.modal-locked .modal-head h3 { color: var(--c-primary); }

.toast-wrap {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 1200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: #22303f; color: #fff; padding: 10px 18px; border-radius: 100px;
  font-size: 13.5px; box-shadow: var(--shadow-l); animation: drop .18s ease-out;
  max-width: 88vw;
}
.toast.ok { background: #1d5b45; }
.toast.err { background: #8f2a2a; }
.toast.warn { background: #7a5312; }
@keyframes drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; } }

/* ---------------------------------------------------------------- 提示条 */

.notice {
  display: flex; gap: 11px; padding: 13px 16px; border-radius: 10px; font-size: 13.5px;
  line-height: 1.75; border: 1px solid transparent;
}
.notice .ni { flex: none; width: 17px; height: 17px; border-radius: 50%; margin-top: 3px;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; }
.notice-info { background: var(--c-primary-soft); border-color: #cfe1f3; }
.notice-info .ni { background: var(--c-primary); }
.notice-warn { background: var(--c-amber-light); border-color: #f0d9a8; }
.notice-warn .ni { background: #ba7517; }
.notice-ok { background: var(--c-teal-light); border-color: #b6e0cf; }
.notice-ok .ni { background: var(--c-teal); }
.notice-bad { background: var(--c-red-light); border-color: #eec6c6; }
.notice-bad .ni { background: var(--c-red); }

/* 测试账号专用提示条（快速测试）：与业务提示区分开，一眼看出是测试用入口 */
.notice-test { background: #f5f0ff; border-color: #d9c9ff; }
.notice-test .ni { background: #7c3aed; }

/* 少量文字色工具类（页面上以 class 形式写内联颜色不便时使用） */
.c-red { color: var(--c-red); }
.c-green { color: var(--c-green); }
.c-amber { color: var(--c-amber); }
.c-teal { color: var(--c-teal); }

/* ---------------------------------------------------------------- 人脸核身 · 扫码区

   二维码是这一屏的主角：左边码、右边三步引导（窄屏自动上下排）。
   二维码本体由 assets/js/qr.js 生成 SVG，这里只负责尺寸与留白 ——
   缩放时必须整块等比缩放，否则会扫不出来。 */

.qr-wrap {
  display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap;
  padding: 20px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fbfcfe;
}
.qr-box {
  flex: none; width: 216px; height: 216px; padding: 10px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.qr-box svg { width: 100%; height: 100%; display: block; }
/* 码生成失败 / 组件缺失时的降级盒子：保持同尺寸，避免布局跳动 */
.qr-box.qr-empty {
  width: auto; min-width: 216px; height: auto; min-height: 216px;
  border-style: dashed; text-align: center; padding: 18px;
}
.qr-side { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.qr-step { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.6; }
.qr-step .qr-n {
  flex: none; width: 21px; height: 21px; border-radius: 50%; margin-top: 1px;
  background: var(--c-primary); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.qr-tip {
  font-size: 12.5px; color: var(--c-amber); background: var(--c-amber-light);
  border: 1px solid #f0d9a8; border-radius: 8px; padding: 9px 12px; line-height: 1.7;
}
/* 手动网址：等宽字体 + 允许折行，方便在手机浏览器里照着输 */
.qr-url { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }

/* 轮询状态行：手机端做完核身后这里会变成「已通过」，因此要留足高度防跳动 */
.face-status { margin-top: 16px; font-size: 13.5px; min-height: 22px; }

/* 演示通道兜底区（折叠） */
.demo-fold { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 12px 14px; }
.demo-fold > summary { cursor: pointer; font-size: 13px; color: var(--t-2); }
.demo-fold > summary:hover { color: var(--c-primary); }

/* ---------------------------------------------------------------- 其他 */

.kv { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--t-2); }
.kv dd { margin: 0; }

.divider { height: 1px; background: var(--border); margin: 18px 0; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; }
.pager .pg { font-size: 13px; color: var(--t-2); }

.chart-bars { display: flex; flex-direction: column; gap: 13px; }
.chart-bars .cb { font-size: 13px; }
.chart-bars .cb .lbl { display: flex; justify-content: space-between; margin-bottom: 5px; }
.chart-bars .cb .lbl b { font-variant-numeric: tabular-nums; }

.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border); background: #fbfcfe;
}

.file-drop {
  border: 1.5px dashed var(--border-strong); border-radius: 10px; padding: 22px;
  text-align: center; color: var(--t-2); font-size: 13.5px; cursor: pointer; background: #fbfcfe;
}
.file-drop:hover { border-color: var(--c-primary); color: var(--c-primary); background: var(--c-primary-soft); }

.print-only { display: none; }

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  /* 证书编辑器：窄屏把画布与侧栏上下排（画布在上，先看到证书） */
  .ce-main { grid-template-columns: minmax(0, 1fr); }
  .ce-canvas, .ce-side { max-height: none; }
  .shell { grid-template-columns: 1fr; }
  .side { border-right: none; border-bottom: 1px solid var(--border); display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px; }
  .side .grp { display: none; }
  .side a { white-space: nowrap; margin-bottom: 0; }
  .side a .badge { display: none; }
  /* 首页目录改为顶部横向可滚动条 */
  .home-layout { grid-template-columns: 1fr; gap: 16px; }
  .home-side {
    position: static; display: flex; gap: 6px; overflow-x: auto;
    padding: 9px; border-radius: var(--radius);
  }
  .home-side .hd, .home-side .sep, .home-side .tip, .home-side .batch-tip { display: none; }
  .home-side a.nv { white-space: nowrap; margin-bottom: 0; flex: none; }
}

@media (max-width: 820px) {
  .login-box { grid-template-columns: 1fr; }
  .login-intro { padding: 30px 26px; }
  .login-intro ul { display: none; }
  .login-form { padding: 30px 26px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .exam-layout { grid-template-columns: 1fr; }
  .topbar .wrap { height: auto; padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
  .topbar nav { margin-left: 0; width: 100%; overflow-x: auto; }
  .topbar-user { margin-left: 0; }
  .main { padding: 16px 14px 50px; }
  .wrap, .wrap-narrow { padding: 0 14px; }
  .hero { padding: 22px 0 26px; }
  .hero h1 { font-size: 19px; }
  .steps { flex-wrap: wrap; gap: 12px 0; }
  .step { flex: 1 1 46%; }
  .step::after { display: none; }
  /* 手机上答题卡占满整行，题号按钮再放大一档，方便手指点选 */
  .answer-sheet { grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 9px; }
  .answer-sheet button { min-height: 50px; font-size: 16px; }
  /* 窄屏：证书是**固定比例的画布**（元素绝对定位），不能改 aspect-ratio，
     否则元素会互相重叠 —— 改为保持 A4 横向比例 + 横向滚动，字号按真证书输出。 */
  .cert { overflow-x: auto; }
  .cert-inner { min-width: 640px; }
  .card-body { padding: 16px; }
  .q-card { padding: 16px; }
  .stat .v { font-size: 22px; }
  .home-side a.nv { padding: 8px 9px; font-size: 13px; }
  .home-side a.nv .bd { margin-left: 5px; }
  /* 扫码核身：窄屏改为竖排（码在上、说明在下），码居中且不再缩小 ——
     手机扫屏上的码本来就吃亏，缩得越小越难扫。 */
  .qr-wrap { flex-direction: column; align-items: center; padding: 16px; }
  .qr-box { width: 240px; height: 240px; }
  .qr-side { flex: 1 1 auto; width: 100%; }
}

/* ---------------------------------------------------------------- 打印 */

/* 证书按 A4 **横向**整页输出（打印对话框里选「另存为 PDF」即为下载）。
   切成纵向时，页面里的脚本会用一条 <style> 覆盖这张纸的方向（见 ui.js 的 certApplyPageSize）。 */
@page { size: A4 landscape; margin: 0; }

@media print {
  body { background: #fff; }
  .no-print, .topbar, .side, .toast-wrap, .modal-foot { display: none !important; }
  .print-only { display: block; }
  .modal-mask { position: static; background: none; padding: 0; backdrop-filter: none; }
  .modal { box-shadow: none; max-width: none; max-height: none; border-radius: 0; }
  .modal-head { display: none; }
  .modal-body { overflow: visible; padding: 0; }
  .cert { box-shadow: none; border: none; padding: 0; max-width: none; width: 297mm; background: #fff; overflow: visible; }
  /* 打印时一页正好一张 A4 横向证书：297mm × 210mm（与屏幕上的比例一致） */
  .cert-inner { width: 297mm; height: 210mm; min-width: 0; aspect-ratio: auto; page-break-inside: avoid; }
  /* 纵向版面：纸张与内页一起转竖 */
  .cert-portrait { width: 210mm; }
  .cert-portrait .cert-inner { width: 210mm; height: 297mm; }
  /* 花边底图、协会徽标、公章按原色输出，不被浏览器的「省墨」处理掉 */
  .cert, .cert-inner, .cert-border img, .cert-badge img, .seal-img {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  /* 画布手柄 / 编辑态描边绝不出现在打印件上 */
  .ce-handle, .ce-frame::after { display: none !important; }
  /* 一次打印 / 下载本单位全部证书时：一张证书一页 */
  .cert + .cert { page-break-before: always; }
}
