/* 学生端样式 */
.stu-bg {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #eef2ff;
  /* 登录页背景图：由管理端「系统设置」配置，经 /api/site 下发
     --login-bg-image 图片地址；--login-veil 蒙板浓度(0=不遮,1=全遮)；--login-bg-size 显示方式 */
  background-image:
    linear-gradient(160deg,
      rgba(238, 242, 255, var(--login-veil, 1)) 0%,
      rgba(244, 246, 250, var(--login-veil, 1)) 40%,
      rgba(239, 246, 255, var(--login-veil, 1)) 100%),
    var(--login-bg-image, none);
  background-repeat: no-repeat, no-repeat;
  background-position: center center, center center;
  background-size: 100% 100%, var(--login-bg-size, 100% 100%);
  background-attachment: fixed, fixed;
}
/* 仅批次选择页套用：固定表头与页脚，仅批次列表内部滚动。
   成绩分析页（result.html）不套用本类，可整页自由滚动。 */
.stu-bg.stu-fixed {
  height: 100vh;
  overflow: hidden;
}
/* 页脚：显示系统副标题（由管理端「系统设置」配置） */
.stu-footer {
  margin-top: auto;
  flex: 0 0 auto;
  text-align: center;
  padding: 22px 24px 26px;
  color: #334155;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.7;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.75);
}
/* 登录视图且配置了背景图时（JS 按视图切换 has-login-bg）：图内已含系统名称与副标题，
   隐藏顶部标题区（T 图标/主标题/副提示）与页脚副标题，避免文字重复叠加；
   批次选择视图会移除该 class，撤掉背景图并恢复标题显示 */
body.has-login-bg .stu-header,
body.has-login-bg .stu-footer { display: none; }
/* 顶部标题/副提示同样加白色描边，背景图较深时仍清晰可读 */
.stu-header h1, .stu-header p {
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.7);
}
.stu-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 28px 24px 10px;
  max-width: 1080px;
  width: 100%;
  flex: 0 0 auto;
  margin: 0 auto;
}
.stu-logo {
  width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.stu-header h1 { font-size: 24px; line-height: 1.3; font-weight: 700; }
.stu-header p { margin: 0; }

.stu-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  flex-direction: column;
}

/* 登录卡片：在 flex 纵向容器里垂直水平居中 */
.stu-login { max-width: 420px; margin: auto; padding: 28px; }

.identity {
  margin-top: 20px;
  padding: 16px;
  border-radius: 10px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  text-align: center;
}
.identity-label { font-size: 12px; color: #0284c7; margin-bottom: 6px; letter-spacing: .5px; }
.identity-name { font-size: 22px; font-weight: 600; color: #0c4a6e; }
.identity-meta { font-size: 13px; color: #0369a1; margin-top: 2px; }

/* 批次选择主区：固定高度容器内纵向排列，只有 batchList 内部滚动 */
.stu-main {
  margin-top: 16px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.stu-userbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #dbeafe; color: #1d4ed8;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 16px; flex: 0 0 auto;
}
/* 考生须知弹窗：分组标题 + 条目 + 重点提示 */
.notice-sec { margin-bottom: 16px; }
.notice-sec:last-child { margin-bottom: 0; }
.notice-sec h4 {
  margin: 0 0 8px; padding-left: 10px;
  border-left: 3px solid #3b82f6;
  font-size: 14px; font-weight: 700; color: #1d4ed8;
}
.notice-sec p, .notice-sec li { font-size: 13.5px; line-height: 1.85; color: #334155; }
.notice-sec ul { margin: 0; padding-left: 20px; }
.notice-sec li { margin-bottom: 3px; }
.notice-sec strong { color: #0f172a; }
.notice-tip {
  margin-top: 8px; padding: 9px 12px;
  background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px;
  font-size: 13px; line-height: 1.8; color: #0c4a6e;
}

/* 考生须知：亮色按钮，与旁边白底的「我的成绩 / 退出」明显区分 */
.btn-notice {
  color: #0369a1;
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  border-color: #7dd3fc;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(14, 165, 233, .18);
}
.btn-notice:hover:not(:disabled) {
  background: linear-gradient(135deg, #bae6fd, #7dd3fc);
  border-color: #38bdf8;
}
.stu-name { font-weight: 600; font-size: 15px; }
/* 区块标题：圆角浅黄底 + 琥珀色轮廓，醒目且与下方圆角标签形状呼应 */
.section-title {
  flex: 0 0 auto;
  display: inline-block;
  align-self: flex-start;   /* 在纵向 flex 容器里只按文字宽度收拢，不拉伸成整行 */
  width: fit-content;
  margin: 0 0 12px;
  padding: 6px 16px;
  background: #fef9c3;          /* 浅黄底，比灰白更醒目 */
  border: 1px solid #fcd34d;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: #92400e;               /* 深琥珀字，保证黄底上的可读性 */
}

/* 仅批次卡片列表滚动，学生信息条(上)与页脚副标题(下)始终固定可见 */
.batch-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.batch-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: all .15s;
}
.batch-item:hover { border-color: #93c5fd; box-shadow: 0 4px 18px rgba(37,99,235,.1); }
.batch-item { color: #0f172a; }
.batch-item-main { flex: 1; min-width: 0; }

/* ---------- 批次模式标签（练习/测试，背景色区别于卡片底） ---------- */
.mode-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  line-height: 1.6;
  letter-spacing: .5px;
}
.batch-item h3 { font-size: 15.5px; margin-bottom: 6px; }
.batch-item .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.batch-item .desc { font-size: 12.5px; color: #64748b; }
.batch-item .side { text-align: right; flex: 0 0 auto; }

/* ---------- 打字页 ---------- */
.typing-body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #f7f9fc;
  /* 背景图通过蒙板淡化（--bg-image / --bg-veil 由 /api/site 下发），看不影响前景文字 */
  background-image:
    linear-gradient(rgba(247, 249, 252, var(--bg-veil, 1)), rgba(247, 249, 252, var(--bg-veil, 1))),
    var(--bg-image, none);
  background-repeat: no-repeat, no-repeat;
  background-position: center center, center center;
  /* 第二层是背景图：--bg-size 由 /api/site 下发（center=居中水印 / stretch=整页拉伸） */
  background-size: 100% 100%, var(--bg-size, auto min(46vh, 440px));
  background-attachment: fixed, fixed;
  overflow: hidden;
}
/* 考场抬头：粗体标题 */
.exam-banner {
  flex: 0 0 auto;
  padding: 9px 24px;
  text-align: center;
  background: linear-gradient(180deg, #eff6ff 0%, #f8fbff 100%);
  border-bottom: 1px solid #dbeafe;
}
.exam-banner b {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a8a;
  letter-spacing: .6px;
}
.typing-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  z-index: 10;
}
.tb-student { font-size: 13.5px; color: #475569; line-height: 1.4; }
.tb-student strong { color: #1e293b; font-size: 14.5px; }
.tb-stats { display: flex; gap: 22px; margin-left: auto; }
.tb-stat { text-align: center; min-width: 64px; }
.tb-stat .v {
  font-size: 20px; font-weight: 600; line-height: 1.15;
  font-variant-numeric: tabular-nums; color: #1e293b;
}
.tb-stat .k { font-size: 11.5px; color: #94a3b8; }
.tb-stat.timer .v { color: #2563eb; }
.tb-stat.timer.warn .v { color: #dc2626; animation: pulse .9s infinite; }
/* 还没开始打字：计时不走，用灰色提示「开始输入即计时」 */
.tb-stat.timer.waiting .v { color: #94a3b8; }
.tb-stat.timer.waiting .k { color: #2563eb; font-weight: 700; }
.tb-stat.errors .v { color: #dc2626; }
/* 暂停（弹出交卷确认框）状态：时钟变灰并提示已暂停 */
.tb-stat.timer.paused .v { color: #b45309; }
.tb-stat.timer.paused .k { color: #b45309; font-weight: 700; }
/* 交卷按钮区与快捷键提示 */
.tb-submit { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-left: 20px; }
.tb-submit .btn { padding: 9px 22px; }
.tb-kbd-hint { font-size: 11.5px; color: #94a3b8; white-space: nowrap; }
.tb-kbd-hint kbd {
  display: inline-block; padding: 0 5px; margin: 0 2px;
  font-family: inherit; font-size: 11px; line-height: 16px;
  color: #475569; background: #f1f5f9;
  border: 1px solid #cbd5e1; border-bottom-width: 2px; border-radius: 4px;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.typing-progress {
  height: 3px;
  background: #e2e8f0;
  flex: 0 0 auto;
}
.typing-progress > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  transition: width .2s;
}

.typing-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 0 200px;
  scroll-behavior: smooth;
}
.typing-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 32px;
}

.line-pair { margin-bottom: 12px; }
.tpl-line, .inp-line {
  font-family: "Consolas", "Menlo", "Microsoft YaHei", "PingFang SC", monospace;
  font-size: 21px;
  line-height: 1.75;
  white-space: nowrap;
  overflow: hidden;
  /* 两行必须完全相同的盒模型，保证逐字上下对齐 */
  border: 1px solid transparent;
  padding: 4px 12px;
}
/* 模板行：浅色底 + 细边，作为输入文字的对照底板 */
.tpl-line {
  color: #8d9aac;
  background: linear-gradient(180deg, #eef3f9 0%, #e6edf7 100%);
  border-color: #dde6f1;
  border-radius: 9px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), 0 1px 2px rgba(15, 23, 42, .04);
}
.tpl-line .done { color: #33415a; }
/* 当前插入位置：静态高亮（不闪烁） */
.tpl-line .ch.cur {
  background: #bfdbfe;
  color: #1e3a8a;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px #93c5fd;
}
.inp-line { color: #1e293b; min-height: 1.75em; margin-top: 2px; }
/* 输入正确 = 蓝色；与模板灰色形成明显区分 */
.inp-line .ok { color: #2563eb; }
.inp-line .bad {
  color: #dc2626;
  background: #fee2e2;
  border-bottom: 2px solid #dc2626;
  border-radius: 2px;
}
.inp-line .blank { color: transparent; }

/* 插入点光标：模板行位置做静态底色提示（不闪烁，不影响评分）
   输入行用独立伪元素画闪烁竖线，避免整字跟着闪 */
@keyframes caretBlink {
  0%, 45% { opacity: 1; }
  55%, 100% { opacity: .12; }
}
.inp-line .ch { position: relative; }
.inp-line .ch.caret::before,
.inp-line .ch.caret-end::after {
  content: '';
  position: absolute;
  top: .12em;
  bottom: .12em;
  width: 2.5px;
  background: #2563eb;
  border-radius: 1px;
  animation: caretBlink 1.05s steps(1, end) infinite;
}
.inp-line .ch.caret::before { left: 0; }
.inp-line .ch.caret-end::after { right: 0; }

.ch {
  display: inline-block;
  text-align: center;
  vertical-align: bottom;
}

/* 考试已结束提示 */
.exam-over {
  max-width: 560px;
  margin: 70px auto 0;
  padding: 44px 32px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}
.exam-over-mark {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  font-size: 32px;
  line-height: 64px;
  font-weight: 700;
}
.exam-over h2 { font-size: 22px; margin-bottom: 10px; color: #1e293b; }
.exam-over p { font-size: 14px; color: #64748b; line-height: 1.9; margin-bottom: 24px; }
.exam-over-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.typing-hint {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 9px 20px 10px;
  background: rgba(255,255,255,.94);
  border-top: 1px solid #e2e8f0;
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  line-height: 1.65;
  color: #94a3b8;
}
.typing-hint kbd {
  padding: 1px 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-family: inherit;
  font-size: 11.5px;
  color: #475569;
}

/* 隐藏输入框：贴在插入点位置（由 JS 定位），输入法候选窗会跟随光标出现 */
#hiddenInput {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 3px;
  height: 1.7em;
  padding: 0;
  border: none;
  outline: none;
  resize: none;
  opacity: 0;
  overflow: hidden;
  font-family: "Consolas", "Menlo", "Microsoft YaHei", "PingFang SC", monospace;
  font-size: 21px;
  color: transparent;
  background: transparent;
  caret-color: transparent;
  z-index: -1;
}

/* 拼音组字浮层：输入法组字过程中，在插入点上方显示正在输入的拼音/字母 */
#compOverlay {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  font-family: "Consolas", "Menlo", "Microsoft YaHei", "PingFang SC", monospace;
  font-size: 19px;
  line-height: 1.5;
  color: #1d4ed8;
  background: rgba(255, 255, 255, .96);
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 1px 8px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .12);
}
#compOverlay[hidden] { display: none; }

/* ---------- 结果页 ---------- */
.result-wrap { max-width: 900px; margin: 0 auto; padding: 28px 24px 60px; }
.score-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 28px;
  text-align: center;
  margin-bottom: 18px;
}
.score-big { font-size: 64px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.score-big.pass { color: #16a34a; }
.score-big.fail { color: #dc2626; }
.score-big.excellent { color: #d97706; }
.score-label { font-size: 13px; color: #94a3b8; margin-top: 6px; }
.score-badge {
  display: inline-block;
  margin-top: 14px;
  padding: 5px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}
.score-badge.pass { background: #dcfce7; color: #15803d; }
.score-badge.fail { background: #fee2e2; color: #b91c1c; }
.score-badge.excellent { background: #fef3c7; color: #b45309; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 760px) {
  .result-grid { grid-template-columns: repeat(2, 1fr); }
}
.result-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.result-item .k { font-size: 12px; color: #94a3b8; margin-bottom: 4px; }
.result-item .v { font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* 测试时间框：容纳「YYYY-MM-DD HH:mm:ss」长字符串，缩小字号并允许换行 */
.result-item .v.time { font-size: 15px; font-weight: 600; line-height: 1.3; letter-spacing: .3px; word-break: break-all; }

.chart-wrap {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
  height: 340px;
  margin-bottom: 18px;
}

/* 成绩页：速度曲线 + 构成饼图并排 */
.chart-row {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
  margin: 18px 0;
}
.chart-card h3 {
  font-size: 15px;
  margin: 0 0 10px;
  color: #1e293b;
}
.chart-row .chart-wrap { margin-bottom: 0; height: 320px; }
@media (max-width: 900px) {
  .chart-row { grid-template-columns: 1fr; }
}
