/* ===== 班级管理 · 积分系统 ===== */
:root {
  --bg: #eef1f6;
  --card: #ffffff;
  --ink: #1b2430;
  --ink-2: #5a6779;
  --ink-3: #8c98a8;
  --line: #e2e7ef;
  --line-2: #cfd7e3;
  --primary: #2f6bff;
  --primary-dark: #1f52d6;
  --primary-soft: #eaf0ff;
  --plus: #15a06a;
  --plus-soft: #e6f7f0;
  --minus: #e2504a;
  --minus-soft: #fdeceb;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 33, 55, .06), 0 8px 24px -12px rgba(20, 33, 55, .18);
  --shadow-lg: 0 24px 60px -20px rgba(15, 25, 45, .38);

  --c0: #8c98a8;
  --c1: #2f6bff;
  --c2: #15a06a;
  --c3: #e08b12;
}

/* 关键：显式写了 display:flex / display:grid 的元素，会覆盖 [hidden] 的
   display:none 默认样式，导致"加了 hidden 却依然显示"。
   这里补一条带 !important 的兜底，凡是 hidden 的元素一律不显示。 */
[hidden] { display: none !important; }

/* 自己写死的默认隐藏（保险起见，不依赖 [hidden]）*/
#bookToolbar[hidden], #petToolbar[hidden], #speciesBook[hidden],
#petGrid[hidden], #petSummary[hidden], #meterPanel[hidden] { display: none !important; }

* { box-sizing: border-box; }

/* 启动失败时的诊断面板：故意做得非常显眼 */
#bootDiag {
  margin: 0;
  padding: 18px 22px;
  background: #7f1d1d;
  color: #ffe4e6;
  font: 13px/1.65 ui-monospace, Consolas, "Cascadia Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  border-bottom: 3px solid #ef4444;
}
#bootDiag[hidden] { display: none; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

h1, h2, h3 { margin: 0; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: min(1880px, 96vw);
  margin: 0 auto;
  padding: 12px 26px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;          /* 屏幕不够宽时按钮整体换行，别把字挤成竖排 */
  gap: 12px 20px;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand-mark {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  background: linear-gradient(140deg, #4b83ff, #2f6bff 55%, #1f52d6);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  box-shadow: 0 6px 16px -6px rgba(47, 107, 255, .8);
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }

.class-name {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 7px;
  padding: 2px 6px;
  margin-left: -6px;
  font-size: 16px;
  font-weight: 650;
  width: 11ch;
  max-width: 100%;
}
.class-name:hover { background: #f3f5f9; }
.class-name:focus { outline: none; background: #fff; border-color: var(--primary); }

.brand-sub { font-size: 12px; color: var(--ink-3); padding-left: 1px; }

.tabs {
  display: flex;
  gap: 4px;
  background: #f1f4f9;
  padding: 4px;
  border-radius: 11px;
  margin-left: 8px;
  flex: 0 0 auto;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  padding: 9px 22px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  transition: .15s;
}
.tab:hover { color: var(--ink); }
.tab.is-active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(20,33,55,.12); }

.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #b9c4d4; background: #fafbfd; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-sm { padding: 7px 13px; font-size: 14px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #eef1f6; border-color: transparent; color: var(--ink); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-plus { background: var(--plus); border-color: var(--plus); color: #fff; padding: 9px 22px; }
.btn-plus:hover { background: #118a5b; border-color: #118a5b; }
.btn-minus { background: #fff; border-color: #f0b6b3; color: var(--minus); padding: 9px 22px; }
.btn-minus:hover { background: var(--minus-soft); border-color: var(--minus); }
.btn.danger { color: var(--minus); border-color: #f0b6b3; }
.btn.danger:hover { background: var(--minus-soft); border-color: var(--minus); }

.icon-btn {
  border: 0;
  background: transparent;
  width: 38px; height: 38px;
  border-radius: 9px;
  font-size: 26px;
  line-height: 1;
  color: var(--ink-3);
  cursor: pointer;
}
.icon-btn:hover { background: #eef1f6; color: var(--ink); }

/* ---------- 布局 ---------- */
.wrap {
  max-width: min(1880px, 96vw);
  margin: 0 auto;
  padding: 20px 26px 60px;
}

.view { display: none; }
.view.is-active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.muted { color: var(--ink-3); font-size: 13px; margin: 0 0 10px; }

/* ---------- 积分面板 ---------- */
.score-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
  margin-bottom: 18px;
}

.score-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.panel-title { font-size: 17px; font-weight: 700; }
.panel-hint { margin: 3px 0 0; font-size: 13px; color: var(--ink-3); }

.selection-tools { display: flex; align-items: center; gap: 8px; }

.pill {
  display: inline-block;
  background: #f1f4f9;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
}
.pill.is-on { background: var(--primary-soft); color: var(--primary); }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(112px, 100%), 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.quick {
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 9px 8px;
  cursor: pointer;
  text-align: center;
  transition: .15s;
  overflow: hidden;
}
.quick:hover { border-color: var(--primary); background: var(--primary-soft); }
.quick:active { transform: translateY(1px); }
.quick-name { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-val { display: block; font-size: 12px; font-weight: 700; color: var(--plus); margin-top: 1px; }
.quick.is-minus .quick-val { color: var(--minus); }

.score-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field-grow { flex: 1 1 220px; min-width: 160px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.req { color: var(--minus); font-style: normal; }

.field input, .field select, .search, .select, textarea {
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 15px;
  transition: .15s;
  width: 100%;
}
.field input:focus, .search:focus, .select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .14);
}
#scoreAmount { width: 92px; }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.search { flex: 1 1 260px; max-width: 400px; }
.select { width: auto; min-width: 150px; }
#groupFilter { max-width: 180px; }

/* ---------- 学生卡片 ---------- */
.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(186px, 100%), 1fr));
  gap: 13px;
}

.student {
  position: relative;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 13px 11px;
  cursor: pointer;
  transition: .15s;
  box-shadow: 0 1px 2px rgba(20,33,55,.05);
  user-select: none;
}
.student:hover { border-color: #b9c8e8; transform: translateY(-1px); box-shadow: var(--shadow); }
.student.is-selected { border-color: var(--primary); background: linear-gradient(180deg, #f6f9ff, #fff); }
.student.is-selected::after {
  content: "✓";
  position: absolute; top: 8px; right: 8px;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  display: grid; place-items: center;
}

.st-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.st-name {
  font-weight: 650;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 16px;
}
.st-points { font-size: 24px; font-weight: 750; letter-spacing: -.5px; line-height: 1.15; }
.st-points.c0 { color: var(--c0); }
.st-points.c1 { color: var(--c1); }
.st-points.c2 { color: var(--c2); }
.st-points.c3 { color: var(--c3); }

.st-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 5px;
  min-height: 16px;
}
.st-group {
  background: #f1f4f9;
  border-radius: 5px;
  padding: 1px 6px;
  font-weight: 600;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.st-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
.st-btn {
  flex: 1;
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 7px;
  padding: 4px 0;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  transition: .15s;
}
.st-btn.plus { color: var(--plus); }
.st-btn.plus:hover { background: var(--plus-soft); border-color: var(--plus); }
.st-btn.minus { color: var(--minus); }
.st-btn.minus:hover { background: var(--minus-soft); border-color: var(--minus); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 620px; }
.table th, .table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.table th {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
  background: #f8fafc;
  white-space: nowrap;
  position: sticky; top: 0;
}
.table tbody tr:hover { background: #f8fafd; }
.table tbody tr:last-child td { border-bottom: 0; }
.col-idx { width: 52px; color: var(--ink-3); }
.col-sid { width: 130px; }
.col-group { width: 110px; }
.col-points { width: 100px; }
.col-pet { width: 160px; }
.col-act { width: 466px; }
.col-time { width: 150px; white-space: nowrap; color: var(--ink-2); font-size: 13px; }
.col-dur { width: 215px; white-space: nowrap; }
.col-nowrap { white-space: nowrap; }
.col-vol { width: 130px; white-space: nowrap; }
.col-peak { width: 120px; white-space: nowrap; color: var(--ink-3); }
.col-amount { width: 84px; }
/* 名单表的姓名列：一定整行显示——窗口窄的时候宁可让表格横向滚一下，
   也不要把「张小明」挤成一字一行（1100px 以下原本会把姓名列压到 57px、四行） */
#rosterTable th:nth-child(2), #rosterTable td:nth-child(2) { white-space: nowrap; min-width: 92px; }

.cell-name { font-weight: 600; }
.cell-name .sub { font-weight: 400; color: var(--ink-3); font-size: 12px; margin-left: 6px; }
.cell-pts { font-size: 17px; font-weight: 700; }
.cell-pts.c0 { color: var(--c0); } .cell-pts.c1 { color: var(--c1); }
.cell-pts.c2 { color: var(--c2); } .cell-pts.c3 { color: var(--c3); }

.amount { font-weight: 700; font-size: 15px; }
.amount.plus { color: var(--plus); }
.amount.minus { color: var(--minus); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mini {
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
  color: var(--ink-2);
}
.mini:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.mini.danger:hover { border-color: var(--minus); color: var(--minus); background: var(--minus-soft); }

.table-foot {
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
  font-size: 13px;
  color: var(--ink-3);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.empty { text-align: center; padding: 60px 20px; color: var(--ink-3); }
.empty-title { font-size: 17px; font-weight: 650; color: var(--ink-2); margin: 0 0 6px; }
.empty-sub { margin: 0 0 18px; font-size: 14px; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(22, 32, 48, .48);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade .15s ease;
  overscroll-behavior: contain;   /* 弹窗里的滑动不要传给后面的页面 */
}
.modal[hidden] { display: none; }

/* 弹窗打开时锁住主界面：手机上在遮罩或卡片空白处上下滑，
   后面的页面不会跟着一起滚（app.js 的 syncModalLock() 负责加/去掉这个类） */
body.modal-open { overflow: hidden; }

.modal-card {
  background: #fff;
  border-radius: 16px;
  width: min(760px, 94vw);
  max-height: min(94vh, 980px);
  display: flex;
  flex-direction: column;
  overflow: hidden;              /* 圆角裁切交给卡片，内部各自滚动 */
  box-shadow: var(--shadow-lg);
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-sm { width: min(460px, 100%); }
.modal-md { width: min(680px, 100%); }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.modal-head h3 { font-size: 17.5px; font-weight: 700; }

/* 关键：作为 flex 子项，min-height 默认是 auto，不会收缩到比内容更小，
   于是内容一多就直接溢出被裁掉、滚动条永远不出现。
   必须显式写 min-height: 0 才能真正滚动起来。 */
.modal-body {
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.modal-body > * { flex: 0 0 auto; }   /* 子块按自身高度排列，不要被压缩 */

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
  background: #fbfcfe;
}

.seg { display: flex; gap: 4px; background: #f1f4f9; padding: 4px; border-radius: 10px; }
.seg-item {
  flex: 1;
  border: 0; background: transparent;
  padding: 7px; border-radius: 7px;
  cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-2);
}
.seg-item.is-active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(20,33,55,.12); }

textarea {
  resize: vertical;
  min-height: 120px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, "Microsoft YaHei", monospace;
  font-size: 13.5px;
  line-height: 1.6;
}

.file-input {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius-sm);
  padding: 22px;
  width: 100%;
  background: #fbfcfe;
  cursor: pointer;
}
.file-input::file-selector-button {
  border: 0; background: var(--primary); color: #fff;
  padding: 8px 16px; border-radius: 8px; margin-right: 14px;
  font-weight: 600; cursor: pointer;
}

.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--primary); flex: 0 0 auto; }

.import-preview { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.preview-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 13px; background: #f8fafc; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 650; color: var(--ink-2);
}
.preview-list { max-height: 190px; overflow: auto; padding: 10px 13px; display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  background: #f1f4f9;
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip .chip-sid { color: var(--ink-3); margin-left: 5px; font-size: 11.5px; }
.chip.warn { background: var(--minus-soft); color: var(--minus); }

.form-error {
  background: var(--minus-soft);
  color: #b93b36;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  margin: 0;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(96px, 100%), 1fr));
  gap: 10px;
}
.stat {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.stat-k { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.stat-v { font-size: 19px; font-weight: 750; margin-top: 2px; }
.stat-v.plus { color: var(--plus); }
.stat-v.minus { color: var(--minus); }

.detail-list-wrap { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.detail-list { max-height: 300px; overflow: auto; }
.detail-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.detail-row:last-child { border-bottom: 0; }
.detail-row .t { color: var(--ink-3); font-size: 12px; width: 96px; flex: 0 0 auto; }
.detail-row .r { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-row .a { font-weight: 700; flex: 0 0 auto; }
.detail-row .a.plus { color: var(--plus); }
.detail-row .a.minus { color: var(--minus); }
.detail-row .x {
  border: 0; background: transparent; color: var(--ink-3);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 5px; border-radius: 5px;
}
.detail-row .x:hover { background: var(--minus-soft); color: var(--minus); }

/* ---------- 排行视图 ---------- */
.rank-card { overflow: visible; margin-bottom: 18px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.card-note { padding: 11px 20px; border-top: 1px solid var(--line); background: #fbfcfe; font-size: 13px; color: var(--ink-3); }

.rank-list { padding: 6px 8px 10px; }

/* ---------- 全班目标（本周一起算，游客/一体机也看得到进度） ---------- */
.goal-card { overflow: visible; margin-bottom: 18px; }
.goal-card.is-done { border-color: #ffd88a; background: linear-gradient(180deg, #fffdf5, #fff); }
body.is-guest-view .goal-card.is-off { display: none !important; }

.goal-empty { margin: 0; padding: 16px 20px 18px; font-size: 13px; color: var(--ink-3); line-height: 1.75; }

.goal-top { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; padding: 15px 20px 0; }
.goal-now { font-size: 30px; font-weight: 780; letter-spacing: -.8px; }
.goal-card.is-done .goal-now { color: #b4760a; }
.goal-den { font-size: 14px; font-weight: 650; color: var(--ink-3); }
.goal-since { font-size: 12px; color: var(--ink-3); margin-left: auto; }

.goal-bar { height: 12px; margin: 10px 20px 0; background: #eef1f6; border-radius: 999px; overflow: hidden; }
.goal-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #8fd0ff, #2f6bff); transition: width .35s; }
.goal-card.is-done .goal-fill { background: linear-gradient(90deg, #ffd75e, #f0a800); }

.goal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 11px 20px 15px; font-size: 13px; color: var(--ink-2); }
.goal-foot b { color: var(--ink); font-weight: 750; }
.goal-more { color: var(--ink-3); font-size: 12px; }
.goal-done { color: #a9670a; font-weight: 650; }

/* 排行榜的「总分 / 本周进步」切换 */
.rank-seg { max-width: 320px; margin: 12px 20px 4px; }

/* 设置目标弹窗里的「统计方式」切换 */
.goal-mode { margin: 4px 0 14px; }
.goal-mode .field-label { display: block; margin-bottom: 7px; }
.goal-mode-seg { max-width: none; margin: 0 0 8px; }
.goal-mode-hint { margin: 0; font-size: 12px; line-height: 1.7; }

.rank-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background .14s;
}
.rank-row:hover { background: #f7f9fd; }
.rank-row.top1 { background: linear-gradient(90deg, #fff9e8, #fffdf7); }
.rank-row.top2 { background: linear-gradient(90deg, #f5f7fa, #fcfdff); }
.rank-row.top3 { background: linear-gradient(90deg, #fdf4ec, #fffdfb); }

.rank-no {
  flex: 0 0 30px;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 750;
  font-size: 13.5px;
  background: #eff2f7;
  color: var(--ink-3);
}
.rank-no.m1 { background: linear-gradient(140deg, #ffd75e, #f0a800); color: #fff; box-shadow: 0 3px 10px -3px rgba(240,168,0,.9); }
.rank-no.m2 { background: linear-gradient(140deg, #d3dbe6, #a3aebd); color: #fff; }
.rank-no.m3 { background: linear-gradient(140deg, #e8b98c, #c98a4b); color: #fff; }

.rank-main { flex: 1 1 auto; min-width: 0; }
.rank-name-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rank-name { font-weight: 650; font-size: 15px; }
.rank-tag {
  background: #f1f4f9;
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 11.5px;
  color: var(--ink-2);
  font-weight: 600;
}
.rank-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }

.rank-bar {
  height: 7px;
  background: #eef1f6;
  border-radius: 999px;
  margin-top: 7px;
  overflow: hidden;
  max-width: 100%;               /* 宽屏上让进度条撑满，别缩在左边一小截 */
}
.rank-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width .3s;
}
.rank-bar-fill.p { background: linear-gradient(90deg, #7fa8ff, #2f6bff); }
.rank-bar-fill.n { background: linear-gradient(90deg, #f4a09c, #e2504a); }

.rank-pts {
  flex: 0 0 auto;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -.5px;
  min-width: 62px;
  text-align: right;
}
.rank-pts.c0 { color: var(--c0); } .rank-pts.c1 { color: var(--c1); }
.rank-pts.c2 { color: var(--c2); } .rank-pts.c3 { color: var(--c3); }

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(232px, 100%), 1fr));
  gap: 12px;
  padding: 15px 20px 18px;
}
.group-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
  background: #fdfefe;
}
.group-card.top-g { border-color: #ffe0a6; background: linear-gradient(180deg, #fffdf6, #fff); }
.group-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.group-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-rank { font-size: 11.5px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.group-total { font-size: 25px; font-weight: 780; letter-spacing: -.6px; margin-top: 5px; }
.group-total .unit { font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.group-meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.group-meta b { color: var(--ink-2); font-weight: 650; }
.group-top3 { font-size: 12px; color: var(--ink-3); margin-top: 9px; line-height: 1.6; }
.group-top3 span { white-space: nowrap; }
.group-top3 b { color: var(--ink-2); font-weight: 600; }

/* ---------- 趋势图 ---------- */
.trend-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
  overflow: hidden;
}
.trend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-2);
  background: #f8fafc;
}
.check-sm { font-size: 12.5px; }
.check-sm span { font-weight: 600; }
.trend-svg { padding: 8px 6px 2px; }
.trend-svg svg { display: block; width: 100%; height: auto; }
.trend-svg .grid-line { stroke: #e6ebf3; stroke-width: 1; stroke-dasharray: 3 3; }
.trend-svg .axis-text { font-size: 10.5px; fill: var(--ink-3); font-weight: 600; }
.trend-svg .spark-circle { fill: #fff; stroke-width: 1.6; }
.trend-svg .spark-poly { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.trend-svg .end-label { font-size: 11px; font-weight: 750; }
.spark-empty { padding: 26px 0; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ---------- 工具箱 ---------- */
.tool-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 15px;
  padding: 18px 22px 20px;
}

.tool-hub-card {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  text-align: left;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  background: #fff;
  cursor: pointer;
  transition: .15s;
  font: inherit;
  color: inherit;
  width: 100%;
}
.tool-hub-card:hover { border-color: #b9c8e8; transform: translateY(-2px); box-shadow: var(--shadow); }
.tool-hub-card .tool-icon { width: 54px; height: 54px; flex: 0 0 54px; font-size: 27px; }
.tool-hub-name { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 7px; }
.tool-hub-badge {
  font-size: 10.5px; font-weight: 750;
  border-radius: 5px; padding: 2px 7px;
  background: var(--primary-soft); color: var(--primary);
  font-weight: 700;
}
.tool-hub-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.65; margin-top: 5px; }
.tool-hub-go { font-size: 12px; font-weight: 650; color: var(--primary); margin-top: 8px; }

.tool-card { margin-bottom: 18px; }
.tool-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tool-icon {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 11px;
  background: linear-gradient(140deg, #eaf0ff, #d8e3ff);
  display: grid; place-items: center;
  font-size: 20px;
}
.tool-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }
.tool-body { padding: 18px 22px; }
.tool-body + .tool-body { border-top: 1px solid var(--line); }

.setup-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.setup-row .field { min-width: 190px; }
.setup-note { font-size: 12.5px; color: var(--ink-3); margin: 0 0 12px; line-height: 1.6; }
.file-warn {
  background: #fff8e6;
  border: 1px solid #ffe1a6;
  border-left: 3px solid #f0a800;
  border-radius: 8px;
  padding: 10px 13px;
  color: #8a5b00;
}
.file-warn b { font-weight: 700; }
.file-warn code {
  background: rgba(240, 168, 0, .16);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, Consolas, monospace;
}
.setup-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  height: 22px;
}
/* 宽屏上别让滑块拉成一条跨半屏的长线，拖起来反而不好控制 */
.setup-row input[type="range"] { max-width: 480px; }

.calib-box { margin-top: 14px; }
.calib-bar { height: 8px; background: #eef1f6; border-radius: 999px; overflow: hidden; }
.calib-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7fa8ff, #2f6bff); transition: width .1s linear; }
.calib-box .muted { margin: 8px 0 0; }

/* 单个音量表（单声道） */
.meter-single {
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px 13px;
  background: #fcfdff;
  margin-bottom: 16px;
  transition: border-color .15s, background .15s;
}
.meter-single.is-hot { border-color: #ffc24d; background: linear-gradient(180deg, #fffdf5, #fff); }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-name { font-weight: 700; font-size: 14.5px; }

.side-db { display: flex; align-items: baseline; gap: 4px; margin: 6px 0 9px; }
.side-db > span:first-child { font-size: 40px; font-weight: 780; letter-spacing: -1.5px; line-height: 1; }
.side-db .unit { font-size: 12px; color: var(--ink-3); font-weight: 600; }

.sound-bar {
  position: relative;
  height: 14px;
  background: #eef1f6;
  border-radius: 999px;
  overflow: hidden;
}
.sound-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #5ec99b, #15a06a 55%, #f0a800 82%, #e2504a);
  background-size: 300px 100%;
  transition: width .08s linear;
}
.sound-peak {
  position: absolute;
  top: 0; bottom: 0;
  width: 2.5px;
  background: #1b2430;
  opacity: .55;
  border-radius: 2px;
  transition: left .2s linear;
}
.side-facts { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin-top: 9px; }
.side-facts b { color: var(--ink-2); font-weight: 700; }

/* 结论 */
.verdict {
  text-align: center;
  font-size: 18px;
  font-weight: 750;
  padding: 15px 16px;
  border-radius: 12px;
  background: #f4f7fc;
  color: var(--ink-2);
  margin-bottom: 16px;
  letter-spacing: .5px;
}
.verdict.is-hot { background: linear-gradient(90deg, #fff4dc, #fff9ec); color: #a9700a; }
.verdict.is-low { background: linear-gradient(90deg, #eef1f6, #f7f9fc); color: #5a6676; }
.verdict.is-ok { background: #eef7f2; color: #10784f; }
.verdict .sub { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin-top: 4px; letter-spacing: 0; }

.session-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(104px, 100%), 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.sstat {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  background: #fbfcfe;
}
.sstat-k { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.sstat-v { display: block; font-size: 17px; font-weight: 750; margin-top: 1px; }

/* 历史记录 */
.reading-compare {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.compare-line { font-size: 13.5px; color: var(--ink-2); line-height: 1.9; }
.compare-line b { font-weight: 700; }
.compare-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; margin-top: 8px; background: #eef1f6; }
.compare-bar .cv { background: #2f6bff; }
.compare-legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-3); margin-top: 7px; }
.compare-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.tag-old {
  display: inline-block;
  margin-left: 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: #8a6b18;
  background: #fff3d6;
  border-radius: 999px;
  padding: 1px 7px;
  vertical-align: middle;
}

/* 对战：逐回合播放的舞台 */
.speed-pick { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.speed-pick .select { width: auto; min-width: 118px; }

.arena-hp span { transition: width .45s cubic-bezier(.3, .8, .4, 1); }
.arena-hp span.is-hit { background: #ff6b6b; }

.arena-fighter { position: relative; }
.pet-avatar {
  width: 62px; height: 62px;
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 34px;
  background: #f1f4f9;
  margin-bottom: 7px;
}
.arena-side.right .pet-avatar { margin-left: auto; }

.pet-dmg {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 19px;
  font-weight: 800;
  color: var(--minus);
  text-shadow: 0 1px 0 #fff, 0 0 8px #fff;
  pointer-events: none;
  animation: dmgFloat 1s ease-out forwards;
  z-index: 3;
  white-space: nowrap;
}
.pet-dmg.heal { color: var(--plus); }
@keyframes dmgFloat {
  0%   { opacity: 0; transform: translate(-50%, 8px) scale(.7); }
  25%  { opacity: 1; transform: translate(-50%, -4px) scale(1.1); }
  70%  { opacity: 1; transform: translate(-50%, -20px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -34px) scale(.95); }
}

.round-sep {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-3); font-size: 12px; font-weight: 700;
  margin: 10px 0 6px;
}
.round-sep::before, .round-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

.fight-controls { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--line); background: #fbfcfe; flex-wrap: wrap; }
.fight-progress { flex: 1 1 140px; height: 6px; background: #eef1f6; border-radius: 999px; overflow: hidden; min-width: 90px; }
.fight-progress span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7fa8ff, #2f6bff); transition: width .2s; }
.fight-round-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.fight-waiting { padding: 26px 16px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

@media (max-width: 700px) {
  .pet-avatar { width: 48px; height: 48px; font-size: 26px; border-radius: 13px; }
  .speed-pick { margin-left: 0; width: 100%; }
  .speed-pick .select { flex: 1; }
}

/* 帮助弹窗 */
.help-step { display: flex; gap: 12px; align-items: flex-start; }
.help-no {
  width: 24px; height: 24px; flex: 0 0 24px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 750;
}
.help-text { min-width: 0; }
.help-text > b { font-size: 14px; }
.help-text p { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.modal-body code {
  background: #f1f4f9;
  border-radius: 5px;
  padding: 1px 6px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  color: #1f52d6;
}

@media (max-width: 700px) {
  .side-db > span:first-child { font-size: 34px; }
  .setup-row .field { min-width: 100%; }
}

/* ---------- 宠物系统 ---------- */
.modal-lg { width: min(1040px, 100%); }
/* 图鉴放大详情：一体机上给学生看，窗口尽量宽 */
.modal-xl { width: min(1340px, 100%); }

/* ============================================================
   宠物图鉴·放大详情（一体机展示用，字大、形象大）
   ============================================================ */
.codex-hero { display: flex; align-items: center; gap: 20px; }
.codex-avatar {
  width: 132px; height: 132px; flex: 0 0 132px;
  border-radius: 26px; display: grid; place-items: center;
  font-size: 74px; background: #f1f4f9; overflow: hidden;
  border: 1px solid var(--line);
}
.codex-avatar img { width: 100%; height: 100%; object-fit: cover; }
.codex-head { min-width: 0; }
.codex-name { font-size: 30px; font-weight: 800; letter-spacing: .5px; }
.codex-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.codex-tags .elem { font-size: 16px; padding: 3px 12px; border-radius: 8px; }
.codex-tag {
  font-size: 14px; font-weight: 700; color: var(--ink-2);
  background: #f1f4f9; border-radius: 8px; padding: 3px 12px;
}
.codex-owner-line { font-size: 14.5px; color: var(--ink-2); margin-top: 10px; line-height: 1.6; }
.codex-owner-line b { color: var(--ink); }

.codex-intro { margin: 4px 0 0; }
.codex-text { font-size: 16px; line-height: 1.75; color: var(--ink-2); margin: 0 0 6px; }
.codex-gameplay { color: var(--ink-3); font-size: 15px; }

.codex-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 12px; }
.codex-stat {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; background: #fbfcfe;
  display: flex; flex-direction: column; gap: 2px;
}
.codex-stat-k { font-size: 15px; font-weight: 700; color: var(--ink-2); }
.codex-stat-v { font-size: 34px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.codex-stat-note { font-size: 12.5px; color: var(--ink-3); }

.codex-skills { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.codex-skill {
  display: flex; align-items: flex-start; gap: 14px;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 15px;
}
.codex-skill.passive { background: #fbfcfe; border-color: #d8d2ff; }
.codex-skill-lv {
  flex: 0 0 auto; font-size: 14px; font-weight: 800;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 8px; padding: 3px 10px;
}
.codex-skill.passive .codex-skill-lv { background: #eae6ff; color: #6b4dff; }
.codex-skill-name { font-size: 19px; font-weight: 750; }
.codex-skill-type {
  font-size: 12px; font-weight: 700; color: var(--ink-3);
  background: #f1f4f9; border-radius: 6px; padding: 2px 8px; margin-left: 8px;
  vertical-align: middle;
}
.codex-skill-desc { font-size: 15px; color: var(--ink-2); line-height: 1.7; margin-top: 4px; }

.codex-elem { padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.codex-elem-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.codex-elem-k {
  flex: 0 0 auto; min-width: 96px; text-align: center;
  font-size: 14.5px; font-weight: 750; border-radius: 8px; padding: 4px 12px;
}
.codex-elem-k.is-good { background: #e6f7f0; color: #0f7a52; }
.codex-elem-k.is-bad { background: #fdeceb; color: #c0392b; }
.codex-elem-k.is-soft { background: #f1f4f9; color: var(--ink-3); }
.codex-elem-v { font-size: 15.5px; color: var(--ink-2); line-height: 1.6; }
.codex-elem-v b { color: var(--ink); }

@media (max-width: 720px) {
  .codex-hero { gap: 14px; }
  .codex-avatar { width: 92px; height: 92px; flex: 0 0 92px; font-size: 52px; border-radius: 20px; }
  .codex-name { font-size: 22px; }
  .codex-stat-v { font-size: 26px; }
  .codex-skill-name { font-size: 16.5px; }
}

.pet-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pet-summary { padding: 12px 20px; border-bottom: 1px solid var(--line); background: #fbfcfe; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.pet-summary b { font-weight: 700; }

.pet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(206px, 100%), 1fr));
  gap: 12px;
  padding: 15px 20px 18px;
}
.pet-empty { grid-column: 1 / -1; text-align: center; color: var(--ink-3); padding: 34px 14px; }

/* 图鉴被删空时的大字提示（一体机上老师也能一眼看到） */
.book-empty { padding: 46px 20px 50px; }
.book-empty-icon { font-size: 56px; line-height: 1; }
.book-empty-title { font-size: 26px; font-weight: 800; color: var(--ink); margin: 14px 0 8px; }
.book-empty-sub { font-size: 15.5px; line-height: 1.75; color: var(--ink-2); max-width: 640px; margin: 0 auto; }

.pet-card {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px 12px;
  background: #fff;
  cursor: pointer;
  transition: .15s;
  position: relative;
  overflow: hidden;
}
.pet-card:hover { border-color: #b9c8e8; transform: translateY(-2px); box-shadow: var(--shadow); }
.pet-card-top { display: flex; align-items: center; gap: 10px; }
.pet-emoji {
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 13px;
  display: grid; place-items: center;
  font-size: 26px;
  background: #f1f4f9;
}
.pet-emoji.stage2 { background: #eaf0ff; }
.pet-emoji.stage3 { background: #ede8ff; }
.pet-emoji.stage4 { background: linear-gradient(140deg, #fff2cf, #ffe0a6); }
.pet-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-owner { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-lv {
  flex: 0 0 auto;
  font-size: 11.5px; font-weight: 750;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 999px; padding: 2px 9px;
}
.pet-stage { font-size: 11.5px; color: var(--ink-3); margin-top: 7px; }
.pet-stage .elem {
  display: inline-block;
  border-radius: 5px;
  padding: 1px 6px;
  font-weight: 700;
  margin-right: 6px;
}

/* 五行说明的鼠标提示（属性标签上） */
.elem { position: relative; cursor: help; }
.elem[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 0;
  top: calc(100% + 7px);
  z-index: 60;
  white-space: nowrap;
  background: #26303d;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.28);
  pointer-events: none;
}
/* 五行：金木水火土，每个属性一个颜色 */
.elem-fire  { background: #fdeceb; color: #d0433d; }
.elem-metal { background: #f7f0d9; color: #8a6a10; }
.elem-wood  { background: #e6f7ee; color: #147a44; }
.elem-water { background: #e9efff; color: #2f5fd0; }
.elem-earth { background: #f7efe4; color: #8a5a24; }

/* 五行生克图（添加自定义宠物用） */
.wuxing {
  display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  background: #f7f8fa;
  border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 18px;
}
.wuxing-svg { width: 240px; max-width: 100%; height: auto; flex: 0 0 auto; }
.wuxing-svg line { stroke-width: 2; }
/* 相生（外圈）用实线，相克（五角星）用虚线，颜色区分 */
.wx-sheng line { stroke: #d8c48a; }
.wx-ke line    { stroke: #d9a3a0; stroke-dasharray: 6 5; }
.wx-node circle { fill: #fff; stroke: #ccd2da; stroke-width: 2; }
.wx-node text {
  text-anchor: middle; dominant-baseline: central;
  font-size: 19px; font-weight: 700; fill: #4a5260;
}
.wx-node.is-on circle { fill: #2f6bff; stroke: #2f6bff; }
.wx-node.is-on text { fill: #fff; }
.wuxing-legend { flex: 1 1 260px; min-width: 0; }
.wuxing-legend p { margin: 0 0 4px; }
.wx-line { font-size: 13.5px; color: var(--ink); }
.wx-detail { font-size: 13px; color: var(--ink-2); letter-spacing: 0.5px; }
.wx-note { font-size: 12.5px; color: var(--ink-3); margin-top: 8px !important; }
.elem-hint { font-size: 13px; margin: 8px 0 4px; min-height: 18px; }
@media (max-width: 720px) {
  .wuxing { justify-content: center; }
  .wuxing-svg { width: 200px; }
}

.pet-bar { height: 6px; background: #eef1f6; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.pet-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7fa8ff, #2f6bff); transition: width .25s; }
.pet-bar.mood span { background: linear-gradient(90deg, #ffd166, #f0a800); }
.pet-bar-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); margin-top: 4px; }

.pet-card-actions { display: flex; gap: 6px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); }
.pet-card-actions .mini { flex: 1; text-align: center; }

/* 领养：种族选择卡 */
.species-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 11px; margin-top: 7px; }
.species-card { max-width: 620px; }
.species-card {
  border: 2px solid var(--line);
  border-radius: 13px;
  padding: 12px 13px;
  background: #fff;
  cursor: pointer;
  transition: .15s;
}
.species-card:hover { border-color: #b9c8e8; }
.species-card.is-picked { border-color: var(--primary); background: linear-gradient(180deg, #f6f9ff, #fff); box-shadow: 0 0 0 3px rgba(47,107,255,.12); }
.species-top { display: flex; align-items: center; gap: 9px; }
.species-emoji { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; display: grid; place-items: center; font-size: 23px; background: #f1f4f9; }
.species-name { font-weight: 700; font-size: 14.5px; }
.species-tag { font-size: 11px; color: var(--ink-3); }
.species-intro { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; margin-top: 8px; }
.species-gameplay { font-size: 12px; color: var(--ink-3); line-height: 1.6; margin-top: 5px; }
.species-nums { display: flex; gap: 9px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-3); margin-top: 8px; }
.species-nums b { color: var(--ink-2); font-weight: 700; }
.species-skills { font-size: 11.5px; color: var(--ink-3); margin-top: 7px; line-height: 1.7; }

/* 宠物详情 */
.pet-hero { display: flex; align-items: center; gap: 14px; }
.pet-hero .pet-emoji { width: 66px; height: 66px; flex: 0 0 66px; font-size: 36px; border-radius: 17px; }
.pet-hero-name { font-size: 19px; font-weight: 750; }
.pet-hero-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

.pet-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(84px, 100%), 1fr)); gap: 9px; }
.pstat { border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; background: #fbfcfe; }
.pstat-k { display: block; font-size: 11px; color: var(--ink-3); font-weight: 650; }
.pstat-v { display: block; font-size: 16px; font-weight: 750; margin-top: 1px; }
.pstat-v small { font-size: 11px; font-weight: 600; color: var(--ink-3); }

.pet-section { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.pet-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 13px; background: #f8fafc; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 650; color: var(--ink-2);
}
.feed-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 11px 13px; }
.feed-btn {
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 9px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: .15s;
  line-height: 1.4;
}
.feed-btn:hover:not(:disabled) { border-color: var(--plus); background: var(--plus-soft); }
.feed-btn:disabled { opacity: .5; cursor: not-allowed; }
.feed-btn .cost { display: block; font-size: 11px; color: var(--ink-3); font-weight: 600; }
.feed-btn .cost.no { color: var(--minus); }

.bag-list { padding: 11px 13px; display: flex; flex-direction: column; gap: 8px; }
.bag-row {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
}
.bag-row.is-empty { color: var(--ink-3); font-size: 13px; border-style: dashed; justify-content: center; }
.bag-emoji { font-size: 21px; flex: 0 0 auto; }
.bag-main { flex: 1; min-width: 0; }
.bag-name { font-weight: 650; font-size: 13.5px; }
.bag-note { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.bag-count { font-size: 12px; font-weight: 700; color: var(--ink-2); flex: 0 0 auto; }
.bag-price { font-size: 12px; font-weight: 700; color: var(--primary); flex: 0 0 auto; }
.bag-price s { color: var(--ink-3); font-weight: 600; margin-right: 3px; }
.bag-price.is-free { color: var(--plus); }

/* ---------- 宠物商店（宽版：一屏看完，尽量不滚动） ---------- */
.modal-shop { width: min(1560px, 96vw); max-height: min(94vh, 920px); }

/* 顶部一条：选人 + 现有积分，横向排，省一层高度 */
.shop-top {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 11px 16px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc;
}
.shop-who { display: flex; align-items: center; gap: 10px; }
.shop-who .field-label { font-size: 13.5px; white-space: nowrap; }
.shop-who .select { min-width: 280px; height: 38px; font-size: 14.5px; }
.shop-points { margin: 0; flex: 1 1 320px; min-width: 220px; font-size: 14px; }

/* 三组商品＝三列，每组内部竖排卡片 */
.shop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.shop-col { border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.shop-col-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.shop-col-title { font-size: 14.5px; font-weight: 700; color: var(--ink-2); }
.shop-col-hint { font-size: 11.5px; color: var(--ink-3); }
.shop-col-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; }

.shop-card {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  transition: .15s;
}
.shop-card:hover { border-color: var(--primary); box-shadow: 0 3px 12px -4px rgba(47, 107, 255, .3); }
.shop-card[data-poor] { background: #fcfdff; }
.shop-emoji { font-size: 27px; line-height: 1; flex: 0 0 auto; }
.shop-main { flex: 1 1 auto; min-width: 0; }
.shop-name { font-weight: 650; font-size: 14.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.shop-have {
  font-size: 11px; font-weight: 700; color: var(--ink-2);
  background: #eef2f7; border-radius: 999px; padding: 1px 8px;
}
.shop-note {
  font-size: 12px; color: var(--ink-3); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.shop-buy { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.shop-buy .bag-price { font-size: 13px; }
.btn-buy {
  font-family: inherit; cursor: pointer;
  border: 1px solid var(--primary); background: var(--primary); color: #fff;
  border-radius: 9px; height: 38px; min-width: 84px; padding: 0 16px;
  font-size: 14.5px; font-weight: 650; transition: .15s;
}
.btn-buy:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-buy:active:not(:disabled) { transform: translateY(1px); }
.btn-buy:disabled {
  background: #f1f4f9; border-color: var(--line); color: var(--ink-3); cursor: not-allowed;
}

@media (max-width: 1180px) {
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .shop-grid { grid-template-columns: minmax(0, 1fr); }
  .shop-who .select { min-width: 200px; }
}

/* ---------- 商店（奖品 / 宠物用品） ---------- */
.shop-page { padding: 16px 20px 20px; }
.shop-tabbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.shop-tabbar .shop-seg { flex: 0 0 auto; }
.shop-tabbar .seg-item { flex: 0 0 auto; padding: 7px 16px; white-space: nowrap; }
.shop-page .shop-top { margin-bottom: 14px; }
.shop-edit-btn { margin-left: auto; flex: 0 0 auto; }
.reward-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 12px;
}
.reward-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 34px 14px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
  line-height: 1.9;
}
@media (max-width: 780px) {
  .shop-page { padding: 12px 14px 16px; }
  .shop-page .shop-top { gap: 10px; }
  .shop-page .shop-who { width: 100%; }
  .shop-page .shop-who .select { min-width: 0; flex: 1 1 auto; }
  .shop-tabbar { gap: 8px; }
  .shop-tabbar .seg-item { flex: 0 0 auto; padding: 6px 12px; font-size: 12.5px; }
}

/* 修改商店价格 */
.shop-edit-row.is-changed { border-color: #ffd88a; background: #fffdf6; }
.shop-orig {
  font-size: 11px; font-weight: 700; color: #a06a00;
  background: #fff3d6; border-radius: 999px; padding: 1px 7px; margin-left: 6px;
}
.price-input-wrap { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.price-input {
  width: 76px; padding: 6px 8px; text-align: right;
  border: 1px solid var(--line-2); border-radius: 8px;
  font-size: 13px; font-weight: 650; color: var(--ink); background: #fff;
}
.price-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,.14); }
.price-input:disabled { background: #f1f4f9; color: var(--ink-3); cursor: not-allowed; }
.price-unit { font-size: 12px; font-weight: 700; color: var(--ink-3); font-style: normal; }
.shop-free {
  display: flex; align-items: center; gap: 5px; flex: 0 0 auto;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.shop-free input { width: 15px; height: 15px; margin: 0; accent-color: var(--plus); }
@media (max-width: 640px) {
  .shop-edit-row { flex-wrap: wrap; }
  .shop-edit-row .bag-main { flex: 1 1 100%; }
}
/* 弹窗外点关闭时，套在上面的弹窗要一起收掉 */
body.no-scroll #modalShopEdit { display: none !important; }

.skill-list { padding: 11px 13px; display: flex; flex-direction: column; gap: 8px; }
.skill-row {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
}
.skill-row.locked { opacity: .55; border-style: dashed; }
.skill-row.passive { background: #fbfcfe; }
.skill-badge {
  flex: 0 0 auto;
  font-size: 10.5px; font-weight: 750;
  border-radius: 5px; padding: 2px 7px;
  background: var(--primary-soft); color: var(--primary);
  margin-top: 1px;
}
.skill-badge.passive { background: #eae6ff; color: #6b4dff; }
.skill-badge.locked { background: #eef1f6; color: var(--ink-3); }
.skill-name { font-weight: 650; font-size: 13.5px; }
.skill-desc { font-size: 12px; color: var(--ink-3); margin-top: 2px; line-height: 1.6; }

/* 对战 */
.battle-pick { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.battle-pick .field { flex: 1 1 220px; }
.vs { font-weight: 800; color: var(--ink-3); padding-bottom: 10px; font-size: 15px; }

.battle-arena {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 14px;
}
.arena-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 13px 15px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.arena-side { min-width: 0; }
.arena-side.right { text-align: right; }
.arena-name { font-weight: 750; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arena-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.arena-vs { font-weight: 800; color: var(--ink-3); font-size: 13px; }
.arena-hp { height: 11px; background: #eef1f6; border-radius: 999px; overflow: hidden; margin-top: 7px; }
.arena-hp span { display: block; height: 100%; border-radius: 999px; transition: width .4s; }
.arena-hp.left span { background: linear-gradient(90deg, #5ec99b, #15a06a); }
.arena-hp.right span { background: linear-gradient(90deg, #7fa8ff, #2f6bff); }
.arena-log { max-height: 250px; overflow: auto; padding: 10px 14px; font-size: 13px; line-height: 1.85; }
.arena-log div { padding: 2px 0; }
.arena-log .l-left { color: #10784f; }
.arena-log .l-right { color: #1f52d6; }
.arena-log .l-info { color: var(--ink-3); font-size: 12.5px; }
.arena-log .l-skill { font-weight: 650; }
.arena-log .l-miss { color: var(--ink-3); font-style: italic; }
.arena-log .l-item { color: #a9700a; font-weight: 600; }
.arena-log .l-end { font-weight: 750; font-size: 14.5px; padding-top: 8px; margin-top: 6px; border-top: 1px dashed var(--line); }
.arena-log .l-start { font-weight: 700; }
.arena-verdict {
  text-align: center; font-size: 17px; font-weight: 780;
  padding: 13px; background: #f4f7fc; color: var(--ink-2);
}
.arena-verdict.left-win { background: linear-gradient(90deg, #e6f7f0, #f2fbf7); color: #10784f; }
.arena-verdict.right-win { background: linear-gradient(90deg, #eaf0ff, #f4f8ff); color: #1f52d6; }
.arena-verdict.draw { background: #f4f7fc; color: var(--ink-2); }

@media (max-width: 700px) {
  .pet-grid { grid-template-columns: repeat(auto-fill, minmax(min(158px, 100%), 1fr)); gap: 10px; padding: 12px 14px 16px; }
  .species-grid { grid-template-columns: 1fr; }
  .pet-head-actions { width: 100%; }
  .pet-head-actions .btn { flex: 1; }
  .arena-head { grid-template-columns: 1fr; text-align: center; }
  .arena-side.right { text-align: center; }
}

.opt-list { padding: 11px 13px; display: flex; flex-direction: column; gap: 10px; }
.opt-list .check { align-items: flex-start; }
.opt-list .check > span { line-height: 1.55; }

/* ---------- 宠物图鉴 ---------- */
/* min-width:0 是必须的：flex 子项默认 min-width:auto，遇到长内容会被撑住或者
   反过来把文字挤成一列一个字。给这些容器设 0，让省略号和换行正常工作。 */
.pet-seg { max-width: 340px; margin: 14px 20px 12px; min-width: 0; }
.pet-seg .seg-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#petToolbar, #bookToolbar { padding: 0 20px; margin-bottom: 12px; min-width: 0; }
.pet-head-actions { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }

/* 图鉴/宠物卡片里的文字统一不允许被压成一列一个字 */
.species-card, .species-card *,
.pet-card, .pet-card * { min-width: 0; }
.species-name, .species-tag, .species-intro, .species-gameplay,
.species-owner, .species-skills, .pet-name, .pet-owner { overflow-wrap: break-word; word-break: break-word; }
.species-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.species-tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pet-card .pet-owner { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 自定义宠物表单里的字段不能被压扁 */
.stat-form .field { min-width: 0; }
.draw-area, .draw-idle, .draw-reveal { min-width: 0; }

.species-card .species-owner {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.6;
}
.species-card .species-owner b { color: var(--ink-2); font-weight: 650; }
.custom-flag {
  display: inline-block;
  font-size: 10.5px; font-weight: 750;
  border-radius: 5px; padding: 1px 6px;
  background: #ede8ff; color: #6b4dff;
  margin-left: 5px;
}
.species-card .species-actions { display: flex; gap: 6px; margin-top: 9px; }
.species-card .species-actions .mini { flex: 1; text-align: center; }

/* ---------- 隐藏宠物 ---------- */
/* 「隐藏」小标：老师看得到真身时标在图鉴卡片和放大详情上 */
.hidden-flag {
  display: inline-block;
  font-size: 10.5px; font-weight: 750;
  border-radius: 5px; padding: 1px 6px;
  background: #fff0d6; color: #a9670a;
  margin-left: 5px;
}
/* 学生 / 家长 / 游客看到的隐藏宠物：一张锁住的卡片，什么都不透露 */
.species-card.is-locked {
  border-style: dashed;
  background: repeating-linear-gradient(135deg, #f8f9fc, #f8f9fc 9px, #f2f4f9 9px, #f2f4f9 18px);
}
.species-card.is-locked:hover { border-color: #c3cddf; }
.species-card.is-locked .species-emoji { background: #e8ebf2; font-size: 19px; }
.species-card.is-locked .species-name { color: var(--ink-2); }
.species-card.is-locked .species-tag { font-style: italic; }
.species-card.is-locked .species-intro { color: var(--ink-3); }

/* ---------- 领养：随机抽取 ---------- */
.draw-area { text-align: center; }
.draw-box {
  width: 96px; height: 96px;
  margin: 0 auto 12px;
  border-radius: 26px;
  display: grid; place-items: center;
  font-size: 52px;
  background: linear-gradient(150deg, #f1f4f9, #e6ecf7);
  box-shadow: inset 0 -3px 0 rgba(20, 33, 55, .06);
}
.draw-box.is-rolling { animation: drawRoll .18s linear infinite; }
@keyframes drawRoll {
  0%   { transform: translateY(0) scale(1); }
  50%  { transform: translateY(-7px) scale(1.06); }
  100% { transform: translateY(0) scale(1); }
}
.draw-rule { font-size: 13px; color: var(--ink-2); line-height: 1.75; margin: 0; }
.draw-reveal { animation: pop .25s cubic-bezier(.2, .9, .3, 1.3); }
.draw-name { font-size: 17px; font-weight: 750; }
.draw-intro { font-size: 13px; color: var(--ink-2); line-height: 1.7; margin-top: 7px; }
.draw-reveal .species-nums, .draw-reveal .species-skills { justify-content: center; }

/* ---------- 领养：指定领养（从图鉴里挑一只） ---------- */
.adopt-seg { margin: 0 0 14px; max-width: 320px; }
.adopt-seg .seg-item { flex: 1 1 0; }
.draw-pick { margin: 0 0 14px; text-align: left; }
.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(108px, 100%), 1fr));
  gap: 9px;
  margin-top: 10px;
  max-height: 268px;
  overflow-y: auto;
  padding: 2px;
}
.pick-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 6px;
  font: inherit; text-align: center; cursor: pointer;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: 13px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.pick-card:hover { border-color: #bac9e8; transform: translateY(-1px); }
.pick-card.is-on {
  border-color: var(--primary);
  background: linear-gradient(180deg, #f5f9ff, #fff);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .12);
}
.pk-emoji { font-size: 26px; line-height: 1.15; }
.pk-emoji img { width: 30px; height: 30px; object-fit: contain; display: block; }
.pk-name { font-size: 12.5px; font-weight: 650; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-tag, .pk-owns { font-size: 10.5px; color: var(--ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
  .adopt-seg { max-width: none; }
  .pick-grid { grid-template-columns: repeat(auto-fill, minmax(min(92px, 100%), 1fr)); max-height: 320px; }
  .pick-card { padding: 9px 4px; }
}

/* ---------- 自定义宠物表单 ---------- */
.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.emoji-btn {
  width: 38px; height: 38px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 20px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: .12s;
}
.emoji-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.emoji-btn.is-picked { border-color: var(--primary); background: var(--primary-soft); }

.stat-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
  gap: 10px;
  padding: 12px 13px 8px;
}
#tplSeg { flex-wrap: wrap; }
#tplSeg .seg-item { flex: 1 1 84px; font-size: 12.5px; padding: 7px 6px; }
.pill.is-over { background: var(--minus-soft); color: var(--minus); }
.pill.is-ok { background: var(--plus-soft); color: var(--plus); }

/* ---------- 通用防挤压 ---------- */
/* 卡片标题区：标题允许收缩并省略，按钮永远不被压扁 */
.card-head { flex-wrap: wrap; }
.card-head .panel-title { min-width: 0; }
.card-head .btn, .card-head .pill, .card-head .icon-btn { flex: 0 0 auto; }
.tool-title { min-width: 0; }
.tool-title > div { min-width: 0; }
.panel-title { overflow-wrap: break-word; }
.tool-sub { overflow-wrap: break-word; }
.brand-text { min-width: 0; }

/* 中等宽度（平板 / 分屏 / 手机横屏）下的宠物页布局 */
@media (max-width: 900px) {
  .pet-seg { max-width: none; }
  #petToolbar, #bookToolbar { gap: 8px; }
  #petToolbar .search, #petToolbar .select { flex: 1 1 150px; max-width: none; }
  #petToolbar .toolbar-right, #bookToolbar .toolbar-right { margin-left: 0; width: 100%; }
  #petToolbar .toolbar-right .btn, #bookToolbar .toolbar-right .btn { flex: 1; }
  .pet-grid { grid-template-columns: repeat(auto-fill, minmax(min(178px, 100%), 1fr)); }
  .species-grid { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
}

/* ---------- 宠物形象：图片上传 ---------- */
.img-form { display: flex; gap: 14px; padding: 13px; align-items: flex-start; flex-wrap: wrap; }
.img-preview {
  width: 96px; height: 96px; flex: 0 0 96px;
  border-radius: 20px;
  display: grid; place-items: center;
  font-size: 42px;
  background: linear-gradient(150deg, #f1f4f9, #e6ecf7);
  border: 1.5px dashed var(--line-2);
  overflow: hidden;
}
.img-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.img-preview.has-img { border-style: solid; border-color: var(--line); background: #fff; }
.img-controls { flex: 1 1 240px; min-width: 0; }
.img-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.img-drop {
  margin: 10px 0 0;
  border: 1.5px dashed var(--line-2);
  border-radius: 10px;
  padding: 11px 13px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
  transition: .15s;
}
.img-drop.is-over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.img-drop.is-error { border-color: #f0b6b3; background: var(--minus-soft); color: var(--minus); }

.emoji-fallback { padding: 12px 13px 13px; border-top: 1px dashed var(--line); }

/* 宠物形象：表情和图片共用同一批容器 */
.pet-emoji img, .species-emoji img, .pet-avatar img, .img-preview img, .draw-box img,
.arena-big-img {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
.pet-emoji, .species-emoji, .pet-avatar, .draw-box { overflow: hidden; }

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 9px;
  pointer-events: none;
}
.toast {
  background: #1e2a3a;
  color: #fff;
  padding: 11px 17px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.55);
  display: flex; align-items: center; gap: 12px;
  animation: slide .22s cubic-bezier(.2,.9,.3,1.2);
  pointer-events: auto;
  max-width: 340px;
}
.toast.ok { background: #10784f; }
.toast.err { background: #b93b36; }
.toast .undo {
  background: rgba(255,255,255,.16);
  border: 0; color: #fff;
  padding: 4px 11px; border-radius: 7px;
  cursor: pointer; font-weight: 650; font-size: 12.5px;
  white-space: nowrap;
}
.toast .undo:hover { background: rgba(255,255,255,.3); }
@keyframes slide { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .topbar-actions { order: 3; margin-left: 0; width: 100%; }
  .topbar-actions .btn { flex: 1; }
  .tabs { order: 4; margin-left: 0; width: 100%; }
  .tab { flex: 1; padding: 7px 0; }
  .wrap { padding: 16px 14px 80px; }
  .student-grid { grid-template-columns: repeat(auto-fill, minmax(min(146px, 100%), 1fr)); gap: 10px; }
  .score-form { gap: 8px; }
  .score-form .field-grow { flex: 1 1 100%; }
  .btn-plus, .btn-minus { flex: 1; }
  .toolbar-right { margin-left: 0; width: 100%; }
  .toolbar-right .btn { flex: 1; }
  .toast-stack { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; }
}

/* ============================================================
   管理员模式（密码锁）
   设计：页面照常浏览，但所有会改数据的操作都要先输密码。
   ============================================================ */

/* 锁定状态下的"只能看"视觉提示：把会改数据的按钮淡下去 */
html.is-locked [data-lock] {
  opacity: .55;
  cursor: not-allowed;
}
html.is-locked [data-lock]:hover { filter: none; }

[data-lock][aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
}
[data-lock][aria-disabled="true"]:hover { filter: none; }

.check-lg { font-size: 14px; }

.auth-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: #e8f3ff; color: #1b5fc4;
  font-size: 12.5px; font-weight: 700;
  border: 1px solid #c9e0ff; cursor: pointer; white-space: nowrap;
}
.auth-chip:hover { background: #d9eaff; }

/* 未进入管理员模式时的提示条（可以点，用来叫出密码框） */
.lock-hint {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: #fff5e6; color: #9a6204;
  border: 1px solid #ffe0ab;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
  cursor: pointer; user-select: none;
}
.lock-hint:hover { background: #ffeed6; }
.lock-hint[hidden] { display: none !important; }

/* 登录用的卡片：现在放在弹窗里（不再是挡住整页的锁屏） */
.lock-card {
  width: 100%; max-width: 430px;
  background: #fff; border-radius: 18px; padding: 30px 28px 26px;
  box-shadow: 0 20px 50px -18px rgba(20, 40, 80, .35);
  border: 1px solid #e6ecf6;
  text-align: center;
}
.lock-icon { font-size: 42px; line-height: 1; margin-bottom: 10px; }
.lock-title { margin: 0 0 8px; font-size: 21px; color: #16233a; }
.lock-sub { margin: 0 0 20px; font-size: 13.5px; color: #64748b; line-height: 1.6; }
.lock-field { text-align: left; margin-bottom: 6px; }
.lock-err {
  min-height: 18px; margin: 6px 0 12px;
  color: #c0392b; font-size: 12.5px; font-weight: 650;
}
.btn-block { width: 100%; justify-content: center; }

@media (max-width: 520px) {
  .lock-card { padding: 24px 18px 20px; }
  .lock-icon { font-size: 34px; }
  .lock-title { font-size: 18px; }
}

/* ============================================================
   工具箱 · 自习课声音检测
   ============================================================ */
.quiet-hero {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px 16px;
  background: #fbfcfe;
  margin-bottom: 16px;
  transition: background .2s, border-color .2s;
}
.quiet-hero.is-over { background: linear-gradient(180deg, #fff5f4, #fffaf9); border-color: #f5c3bf; }
.quiet-hero.is-quiet { background: linear-gradient(180deg, #f2fbf6, #fbfefc); border-color: #bfe3d0; }

.quiet-now { display: flex; align-items: baseline; gap: 6px; }
.quiet-db { font-size: 54px; font-weight: 800; letter-spacing: -2px; line-height: 1; }
.quiet-hero.is-over .quiet-db { color: #d9453f; }
.quiet-hero.is-quiet .quiet-db { color: #10784f; }
.quiet-unit { font-size: 14px; color: var(--ink-3); font-weight: 700; }

.quiet-verdict { font-size: 16px; font-weight: 700; color: var(--ink-2); margin: 8px 0 12px; }
.quiet-hero.is-over .quiet-verdict { color: #c0392b; }

.quiet-bar { height: 18px; }
.quiet-bar .sound-fill.is-over { background: linear-gradient(90deg, #f0932b, #e2504a); }

.quiet-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); margin-top: 10px; }
.quiet-meta b { color: var(--ink-2); font-weight: 700; }

.win-badge.is-left { color: #c0392b; }
.win-badge.is-right { color: #10784f; }
.win-badge.is-warn { color: #b26a00; }

/* 记录表里的「整节课」标签稍微低调一点 */
.win-badge { white-space: nowrap; }

@media (max-width: 560px) {
  .quiet-db { font-size: 42px; }
  .quiet-meta { gap: 12px; }
}

/* ============================================================
   早读质量分析（一次早读结束后显示的评分卡片 + 记录表里的质量分）
   ============================================================ */

.quality-box {
  margin: 16px 20px 4px;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card-2, #f8fafc);
}
.quality-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.quality-score-wrap { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.quality-score { font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.quality-score.q-great { color: #10784f; }
.quality-score.q-good { color: #2f6bff; }
.quality-score.q-mid { color: #b8860b; }
.quality-score.q-poor { color: #d9453f; }
.quality-unit { font-size: 15px; font-weight: 700; color: var(--ink-3); }
.quality-head-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.quality-label { font-size: 17px; font-weight: 800; }
.quality-label.q-great { color: #10784f; }
.quality-label.q-good { color: #2f6bff; }
.quality-label.q-mid { color: #b8860b; }
.quality-label.q-poor { color: #d9453f; }
.quality-meta { font-size: 13px; color: var(--ink-3); }

.quality-bars { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.quality-row-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; font-size: 13.5px; font-weight: 700; color: var(--ink-2);
}
.quality-row-val { font-weight: 800; color: var(--ink-1, #1f2937); white-space: nowrap; }
.quality-row-val i { font-style: normal; font-weight: 600; color: var(--ink-3); }
.quality-bar {
  margin-top: 5px; height: 8px; border-radius: 999px;
  background: var(--line); overflow: hidden;
}
.quality-bar > span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #2f6bff, #15a06a);
}
.quality-row-tip { margin-top: 4px; font-size: 12px; color: var(--ink-3); overflow-wrap: break-word; }

.quality-tips {
  margin-top: 14px; padding: 10px 12px; border-radius: 10px;
  background: #fff; border: 1px dashed var(--line);
  font-size: 13px; color: var(--ink-2); overflow-wrap: break-word;
}
.quality-note { margin-top: 10px; font-size: 12px; color: var(--ink-3); line-height: 1.6; overflow-wrap: break-word; }

/* 记录卡里的质量分汇总条 */
.quality-summary {
  display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap;
  margin: 12px 20px 0; font-size: 13.5px; color: var(--ink-2);
}
.quality-summary b { font-size: 16px; font-weight: 800; color: var(--ink-1, #1f2937); }
.quality-summary .q-avg, .quality-summary .q-best, .quality-summary .q-last { white-space: nowrap; }
.quality-summary .q-last.q-great { color: #10784f; }
.quality-summary .q-last.q-good { color: #2f6bff; }
.quality-summary .q-last.q-mid { color: #b8860b; }
.quality-summary .q-last.q-poor { color: #d9453f; }

/* 记录表里的质量分 */
.q-badge {
  display: inline-block; min-width: 32px; text-align: center;
  padding: 2px 7px; border-radius: 8px;
  font-size: 13px; font-weight: 800; color: #fff;
}
.q-badge.q-great { background: #10784f; }
.q-badge.q-good { background: #2f6bff; }
.q-badge.q-mid { background: #d9a441; }
.q-badge.q-poor { background: #d9453f; }
.q-badge-txt { margin-left: 6px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* 质量达标奖励：设置条 + 记录表里的「达标奖励」列 */
.quality-bonus {
  display: flex; align-items: center; gap: 10px 22px; flex-wrap: wrap;
  margin: 12px 20px 0; padding: 12px 16px;
  border: 1px dashed var(--line-2); border-radius: 11px; background: #fbfcfe;
}
.qb-title { font-size: 14px; font-weight: 700; color: var(--ink-1, #1f2937); white-space: nowrap; }
.qb-field { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }
.qb-num {
  width: 74px; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 8px;
  font-size: 15px; font-weight: 700; color: var(--ink-1, #1f2937); text-align: center;
  background: #fff; font-family: inherit;
}
.qb-num:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.qb-hint { flex: 1 1 240px; font-size: 12.5px; color: var(--ink-3); }
.col-bonus { width: 200px; }
.col-bonus .row-actions { align-items: center; }
.bonus-done { font-size: 13px; font-weight: 700; color: #10784f; white-space: nowrap; }
.mini.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.mini.primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); color: #fff; }
.quality-summary .q-bonus { white-space: nowrap; color: var(--ink-3); }
.quality-summary .q-bonus b { color: var(--primary); }

/* 早读记录详情弹窗里的「质量达标奖励」一行（在这里也能直接加 / 收回） */
.reading-bonus-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: 12px;
  background: #f4f7ff; border: 1px solid #d9e4ff;
}
.reading-bonus-row[hidden] { display: none; }
.reading-bonus-row .rb-text { flex: 1 1 260px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.reading-bonus-row .rb-text b { color: var(--ink-1, #1f2937); }
.reading-bonus-row .btn { flex: 0 0 auto; }

/* ============================================================
   早读记录详情弹窗（#modalReading）
   ============================================================ */

/* 弹窗里已经有内边距了，评分卡片不要再套一层外边距 */
#modalReading .modal-body .quality-box { margin: 14px 0 0; }
.quality-tip-head { margin-right: 6px; }

.detail-facts {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.fact-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.fact-row:last-child { border-bottom: 0; }
.fact-row:nth-child(odd) { background: #fbfcfe; }
.fact-k { color: var(--ink-3); flex: 0 0 auto; }
.fact-v { font-weight: 700; color: var(--ink-1, #1f2937); text-align: right; min-width: 0; overflow-wrap: break-word; }

/* 记录表里「详情」按钮和「删除」并排，窄屏不要挤成一团 */
.reading-row .row-actions { white-space: nowrap; }

#readingDetailNote { padding: 0; margin-top: 14px; border-top: 0; background: none; }

@media (max-width: 560px) {
  .quality-score { font-size: 42px; }
  .quality-head { gap: 12px; }
  .quality-box { margin: 14px 14px 4px; padding: 14px; }
  .quality-summary { margin: 12px 14px 0; }
  #modalReading .modal-body .quality-box { margin: 14px 0 0; }
  .fact-row { flex-direction: column; align-items: flex-start; gap: 3px; }
  .fact-v { text-align: left; }
}

/* ---------- 自习课：扣分/冷却等设置默认收起 ---------- */
.quiet-adv { margin: 0 0 14px; }
.quiet-adv-toggle {
  width: 100%;
  min-width: 0;
  justify-content: flex-start;
  gap: 8px;
  text-align: left;
  padding: 8px 12px;
  color: var(--ink-2);
}
.quiet-adv-toggle:hover { background: #eef1f6; color: var(--ink); }
.quiet-adv-toggle .quiet-adv-ico { flex: 0 0 auto; }
.quiet-adv-toggle .quiet-adv-title { font-weight: 700; flex: 0 0 auto; }
.quiet-adv-sum {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
}
.quiet-adv-toggle.is-open .quiet-adv-sum { display: none; }
.quiet-adv-arrow { flex: 0 0 auto; margin-left: auto; font-size: 12px; color: var(--ink-3); }
.quiet-adv-body {
  margin-top: 10px;
  padding: 14px 14px 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfd;
}
.quiet-adv-body .setup-note:last-child { margin-bottom: 12px; }
@media (max-width: 560px) {
  .quiet-adv-sum { display: none; }
  .quiet-adv-body { padding: 12px 10px 0; }
}

/* 勾选框不要跟着输入框拉满一整行，否则同一行后面的文字会被挤到下一行 */
.field input[type="checkbox"] {
  width: auto;
  padding: 0;
  margin: 0 6px 0 0;
  flex: 0 0 auto;
  vertical-align: -1px;
}

/* ---------- 自习课：奖励那行写成一整句，勾选框和输入框同一个基线 ---------- */
.quiet-rule-row { align-items: center; gap: 10px 16px; }
.quiet-rule-part {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.quiet-rule-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.quiet-rule-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--primary);
}
.quiet-num {
  width: 70px;
  flex: 0 0 auto;
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  font-size: 14px;
  text-align: center;
  transition: .15s;
}
.quiet-num:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .14);
}
.quiet-rule-txt { flex: 0 0 auto; font-size: 13px; color: var(--ink-2); }
.quiet-rule-part.is-off .quiet-num,
.quiet-rule-part.is-off .quiet-rule-txt { opacity: .45; }

/* ---------- 等级徽章 ---------- */
.lv-badge {
  display: inline-flex; align-items: center; gap: 3px;
  flex: 0 0 auto;
  font-size: 11px; font-weight: 750;
  border-radius: 999px; padding: 1px 8px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.lv-bronze  { background: #fbeee2; color: #9a5b23; border-color: #f0d9c2; }
.lv-silver  { background: #eef1f6; color: #5b6b82; border-color: #dde3ec; }
.lv-gold    { background: #fff5da; color: #966d00; border-color: #f6e2a8; }
.lv-diamond { background: #e6f4ff; color: #0b6fbf; border-color: #c3e4fb; }
.lv-violet  { background: #f4ecff; color: #6b34c4; border-color: #e3d3fb; }
.lv-jade    { background: #e6f7ef; color: #0d7a53; border-color: #c6ebda; }
.lv-none    { background: #f4f6fa; color: var(--ink-3); border-color: #e9edf4; }
/* 等级设置里名字被清空时的占位（这时还没保存，允许空着继续打字） */
.lv-noname  { color: var(--ink-3); font-style: normal; }

.st-level-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.st-level-next { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.rank-lv { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- 随机点名 ---------- */
.pick-stage {
  border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(180deg, #fbfcff, #f3f6fd);
  padding: 26px 18px; text-align: center; margin: 4px 0 14px;
}
.pick-name {
  font-size: 34px; font-weight: 800; letter-spacing: 1px;
  color: var(--ink); line-height: 1.25; min-height: 44px;
  word-break: break-all; transition: color .12s;
}
.pick-name.is-idle { font-size: 17px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.pick-name.is-rolling { color: var(--primary); }
.pick-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 7px; min-height: 17px; }
.pick-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pick-hint { font-size: 13px; color: var(--ink-2); }
.pick-num {
  width: 62px; flex: 0 0 auto;
  border: 1px solid var(--line-2); background: #fff; border-radius: var(--radius-sm);
  padding: 7px 9px; font-size: 14px; text-align: center;
}
.pick-num:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,.14); }
.btn.btn-plus { background: var(--plus-soft); color: #1f7a4d; border-color: #c7e8d6; }
.btn.btn-plus:hover:not(:disabled) { background: #d9f2e4; }
.btn.btn-plus:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 管理奖品 ---------- */
.reward-add {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  border: 1px dashed var(--line-2); border-radius: 10px;
  padding: 10px 12px; margin-top: 10px; background: #fbfcfe;
}
.reward-add-title { font-size: 12.5px; font-weight: 700; color: var(--ink-2); flex: 0 0 auto; }
.reward-emoji, .reward-new-name, .reward-new-desc, .reward-price,
.re-emoji, .re-name, .re-desc, .re-price {
  border: 1px solid var(--line-2); border-radius: 8px; background: #fff;
  padding: 6px 8px; font-size: 13px; color: var(--ink);
}
.reward-emoji, .re-emoji { width: 52px; text-align: center; font-size: 15px; flex: 0 0 auto; }
.reward-new-name, .re-name { width: 128px; font-weight: 650; flex: 0 0 auto; }
.reward-new-desc, .re-desc { flex: 1 1 150px; min-width: 110px; }
.reward-price, .re-price { width: 68px; text-align: right; font-weight: 650; flex: 0 0 auto; }
.reward-emoji:focus, .reward-new-name:focus, .reward-new-desc:focus, .reward-price:focus,
.re-emoji:focus, .re-name:focus, .re-desc:focus, .re-price:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,.14);
}
.reward-row.is-changed { border-color: #ffd88a; background: #fffdf6; }
.reward-del, .lv-del {
  flex: 0 0 auto; border: 1px solid var(--line-2); background: #fff;
  border-radius: 8px; padding: 5px 10px; font-size: 12.5px; font-weight: 650;
  color: var(--minus); cursor: pointer; transition: .15s;
}
.reward-del:hover, .lv-del:hover { background: var(--minus-soft); border-color: #f6c9c5; }

/* ---------- 等级设置 ---------- */
.level-edit-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.level-edit-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
}
.level-edit-row .lv-badge { font-size: 12px; padding: 3px 10px; min-width: 74px; justify-content: center; }
.level-edit-row .lv-icon {
  flex: 0 0 auto; width: 46px; text-align: center; font-size: 15px;
  border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 4px; background: #fff;
}
.level-edit-row .lv-name {
  flex: 0 0 auto; width: 104px; font-weight: 650; font-size: 13px;
  border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 8px; background: #fff;
}
.level-edit-row .lv-min {
  flex: 0 0 auto; width: 84px; border: 1px solid var(--line-2); border-radius: 8px;
  padding: 6px 8px; text-align: right; font-size: 13px; font-weight: 650; background: #fff;
}
.level-edit-row .lv-icon:focus, .level-edit-row .lv-name:focus, .level-edit-row .lv-min:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,.14);
}
.level-edit-row .lv-del { margin-left: auto; }
.level-edit-row .lv-gap {
  flex: 1 0 100%; text-align: right; margin-top: 2px;
  font-size: 12px; color: var(--ink-3);
}
.level-add { width: 100%; margin-top: 9px; border-style: dashed; }
.level-add:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 560px) {
  .reward-new-desc, .re-desc { flex: 1 1 100%; }
  .pick-name { font-size: 26px; }
}

/* ---------- 「必须登录才能看数据」的提示条 ---------- */
.auth-warn {
  margin: 0 0 18px; padding: 14px 18px;
  border: 1px solid #f0d48a; background: #fff8e1;
  border-radius: 14px; color: #7a5a00;
  font-size: 15px; line-height: 1.7;
}
.auth-warn b { color: #66490a; }
.auth-warn[hidden] { display: none; }

/* ============================================================
   手机窄屏补丁：修「按钮跑到屏幕外」（2026/10/7）
   起因：412px 手机上顶栏「导入备份」溢出 2px、名册工具栏
   六个按钮排成一行 588px 被裁掉（用户报障）。
   只在 ≤720px 生效，桌面完全不受影响。
   ============================================================ */
@media (max-width: 720px) {
  /* 顶栏：品牌 / 提示条 / 按钮 各占一行 */
  .topbar-inner { flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; }
  .topbar-actions { flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
  .topbar-actions .lock-hint { flex: 1 1 100%; justify-content: center; }
  .topbar-actions .auth-chip { flex: 0 1 auto; }
  /* 「我是谁」小标独占一行居中，下面四个按钮整齐两列 */
  .topbar-actions .user-chip { flex: 1 1 100%; justify-content: center; padding: 7px 12px; }
  .topbar-actions .btn { flex: 1 1 calc(50% - 4px); min-width: 0; padding: 10px 12px; }
  /* 手机没有 hover（原来是 btn-ghost 全透明 → 看着只有文字），显形成一个白色按钮 */
  .topbar-actions .btn-ghost {
    background: #fff;
    border-color: var(--line-2);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(20, 33, 55, .06);
  }
  .topbar-actions .btn-ghost:active { background: #eef2f9; }
  /* 账号是常用入口，给一点颜色 */
  .topbar-actions #btnAccounts {
    background: var(--primary-soft);
    border-color: #cddcff;
    color: var(--primary-dark);
  }
  .topbar-actions #btnAccounts:active { background: #dde7ff; }

  /* 页签条：窄屏下可以横向滑，不撑破页面 */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 1 0 auto; padding: 7px 10px; }

  /* 名册等工具栏：按钮换行，一行三个，不再被裁掉 */
  .toolbar { flex-wrap: wrap; }
  .toolbar-right { flex-wrap: wrap; gap: 6px; }
  .toolbar-right .btn { flex: 1 1 calc(33.333% - 6px); min-width: 0; }
  .toolbar .search, .toolbar .select { flex: 1 1 100%; max-width: none; }

  .wrap { padding: 14px 12px 72px; }
}
/* ---------- 手机上把名单表格变成卡片（≤640px） ---------- */
@media (max-width: 640px) {
  /* 表头藏掉，表格不再横向滚动 */
  #rosterTable thead { display: none; }
  #rosterTable, #rosterTable tbody { display: block; width: 100%; min-width: 0; }
  #rosterTable tr {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    padding: 12px 13px 10px;
    margin-bottom: 10px;
  }
  #rosterTable tbody tr:hover { background: #fff; }
  #rosterTable tr:last-child { margin-bottom: 0; }
  #rosterTable td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
    text-align: left;
  }
  /* 序号做成小圆点 */
  #rosterTable td.col-idx {
    order: 1; flex: 0 0 auto; width: auto;
    font-size: 12px; font-weight: 700; color: var(--ink-3);
    background: #f1f4f9; border-radius: 999px; padding: 1px 8px;
  }
  /* 姓名（占满剩余）+ 积分（大字） */
  #rosterTable td:nth-child(2) { order: 2; flex: 1 1 auto; font-size: 16px; }
  #rosterTable td:nth-child(5) { order: 3; flex: 0 0 auto; }
  #rosterTable .cell-pts { font-size: 21px; }
  /* 学号 / 小组：小字带标签，占位「—」的整格藏掉 */
  #rosterTable td:nth-child(3),
  #rosterTable td:nth-child(4) {
    order: 4; flex: 0 0 auto;
    font-size: 12.5px; color: var(--ink-3);
  }
  #rosterTable td:nth-child(3)::before { content: "学号 "; }
  #rosterTable td:nth-child(4)::before { content: "小组 "; }
  #rosterTable td:nth-child(3):has(> .muted),
  #rosterTable td:nth-child(4):has(> .muted) { display: none; }
  /* 宠物：名字太长就省略号 */
  #rosterTable td:nth-child(6) { order: 5; flex: 0 1 auto; max-width: 100%; }
  #rosterTable td:nth-child(6) .mini {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* 操作按钮：整行铺满，一行四个 / 手指好点 */
  #rosterTable td:nth-child(7) {
    order: 6; flex: 1 1 100%;
    margin-top: 6px; padding-top: 10px;
    border-top: 1px dashed var(--line);
  }
  #rosterTable .row-actions { gap: 6px; }
  #rosterTable .row-actions .mini {
    flex: 1 1 0;
    min-width: 68px;
    text-align: center;
    padding: 7px 4px;
    font-size: 13px;
  }
  /* 空名单 / 没匹配 的那一行撑满整张卡 */
  #rosterTable td[colspan] { flex: 1 1 100%; }
}

/* ---------- 手机上把积分记录表变成卡片（≤640px） ---------- */
@media (max-width: 640px) {
  #historyTable thead { display: none; }
  #historyTable, #historyTable tbody { display: block; width: 100%; min-width: 0; }
  #historyTable tr {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    padding: 12px 13px 10px;
    margin-bottom: 10px;
  }
  #historyTable tbody tr:hover { background: #fff; }
  #historyTable tr:last-child { margin-bottom: 0; }
  #historyTable td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
    text-align: left;
    white-space: normal;
  }
  /* 学生（占满剩余）+ 分值（大字，永远推到这一行的最右边） */
  #historyTable td:nth-child(2) { order: 1; flex: 1 1 auto; font-size: 15px; }
  #historyTable td:nth-child(3) { order: 2; flex: 0 0 auto; margin-left: auto; }
  #historyTable .amount { font-size: 19px; }
  /* 时间紧跟分值，仍在第一行 */
  #historyTable td.col-time {
    order: 3; flex: 0 0 auto; width: auto;
    font-size: 12.5px; color: var(--ink-3);
    white-space: nowrap;
  }
  /* 原因单独占一行：名字短的时候也不会挤到分值和名字中间，所有记录卡片格式一致 */
  #historyTable td:nth-child(4) {
    order: 4; flex: 1 1 100%;
    font-size: 13px; color: var(--ink-2);
    word-break: break-word;
  }
  /* 操作按钮铺满一行 */
  #historyTable td:nth-child(5) {
    order: 5; flex: 1 1 100%;
    margin-top: 6px; padding-top: 10px;
    border-top: 1px dashed var(--line);
  }
  #historyTable .row-actions { gap: 6px; }
  #historyTable .row-actions .mini {
    flex: 1 1 0;
    min-width: 68px;
    text-align: center;
    padding: 7px 4px;
    font-size: 13px;
  }
  #historyTable td[colspan] { flex: 1 1 100%; }
}
/* ---------- 手机：学生明细弹窗（等级卡片里的图标/文字不再溢出屏幕） ---------- */
.stat { min-width: 0; }
.st-level-next { white-space: normal; }
@media (max-width: 640px) {
  .detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .detail-stats .stat { padding: 9px 11px; }
  .detail-stats .stat:last-child { grid-column: 1 / -1; }
  .detail-stats .stat-k { font-size: 11px; }
}
/* ---------- 手机：早读记录表变成卡片（工具箱 / 老师手机上看得清） ---------- */
@media (max-width: 640px) {
  #readingTable thead { display: none; }
  #readingTable, #readingTable tbody { display: block; width: 100%; min-width: 0; }
  #readingTable tr {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    padding: 12px 13px 10px;
    margin-bottom: 10px;
  }
  #readingTable tbody tr:hover { background: #fff; }
  #readingTable tr:last-child { margin-bottom: 0; }
  #readingTable td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
    text-align: left;
    white-space: normal;
  }
  /* 第一行：时间 + 质量分（靠右） */
  #readingTable td.col-time {
    order: 1; flex: 0 0 auto; width: auto;
    font-size: 12.5px; color: var(--ink-3); white-space: nowrap;
  }
  #readingTable td:nth-child(2) { order: 2; flex: 0 0 auto; margin-left: auto; }
  #readingTable .q-badge-txt { font-size: 11.5px; }
  /* 第二行：平均音量 + 最高音量 */
  #readingTable td.col-vol { order: 3; flex: 0 0 auto; font-size: 13px; font-weight: 700; }
  #readingTable td.col-peak { order: 4; flex: 0 0 auto; font-size: 12.5px; color: var(--ink-3); }
  #readingTable td.col-peak::before { content: "最高 "; color: var(--ink-3); }
  /* 第三行：时长（小字灰字） */
  #readingTable td.col-dur {
    order: 5; flex: 1 1 100%;
    font-size: 12.5px; color: var(--ink-3);
  }
  /* 达标奖励（可能要放按钮）与操作各占一行，上面一条虚线 */
  #readingTable td.col-bonus {
    order: 6; flex: 1 1 100%;
    margin-top: 6px; padding-top: 10px;
    border-top: 1px dashed var(--line);
  }
  #readingTable td.col-act {
    order: 7; flex: 1 1 100%;
    margin-top: 6px; padding-top: 10px;
    border-top: 1px dashed var(--line);
  }
  #readingTable .row-actions { gap: 6px; }
  #readingTable .row-actions .mini {
    flex: 1 1 0; min-width: 68px;
    text-align: center; padding: 7px 4px; font-size: 13px;
  }
  #readingTable .bonus-done { font-size: 13px; }
  #readingTable td[colspan] { flex: 1 1 100%; }
}
/* ---------- 手机：自习课检测记录表变成卡片 ---------- */
@media (max-width: 640px) {
  #quietLogTable thead { display: none; }
  #quietLogTable, #quietLogTable tbody { display: block; width: 100%; min-width: 0; }
  #quietLogTable tr {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    padding: 12px 13px 10px;
    margin-bottom: 10px;
  }
  #quietLogTable tbody tr:hover { background: #fff; }
  #quietLogTable tr:last-child { margin-bottom: 0; }
  #quietLogTable td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
    text-align: left;
    white-space: normal;
  }
  /* 第一行：时间 + 类型徽章（靠右） */
  #quietLogTable td.col-time {
    order: 1; flex: 0 0 auto; width: auto;
    font-size: 12.5px; color: var(--ink-3); white-space: nowrap;
  }
  #quietLogTable td:nth-child(2) {
    order: 2; flex: 0 0 auto; margin-left: auto;
    font-size: 12.5px; color: var(--ink-3);
  }
  /* 第二行：超标 / 扣分 / 奖励 */
  #quietLogTable td:nth-child(3) { order: 3; flex: 0 1 auto; font-size: 12.5px; color: var(--ink-2); }
  #quietLogTable td:nth-child(3)::before { content: "超标 "; color: var(--ink-3); }
  #quietLogTable td:nth-child(4) { order: 4; flex: 0 1 auto; font-size: 12.5px; color: var(--ink-2); }
  #quietLogTable td:nth-child(4)::before { content: "扣分 "; color: var(--ink-3); }
  #quietLogTable td:nth-child(5) { order: 5; flex: 0 1 auto; font-size: 12.5px; color: var(--ink-2); }
  #quietLogTable td:nth-child(5)::before { content: "奖励 "; color: var(--ink-3); }
  /* 删除按钮铺满一行 */
  #quietLogTable td:nth-child(6) {
    order: 6; flex: 1 1 100%;
    margin-top: 6px; padding-top: 10px;
    border-top: 1px dashed var(--line);
  }
  #quietLogTable .row-actions { gap: 6px; }
  #quietLogTable .row-actions .mini {
    flex: 1 1 0; min-width: 68px;
    text-align: center; padding: 7px 4px; font-size: 13px;
  }
  #quietLogTable td[colspan] { flex: 1 1 100%; }
}
/* =======================================================================
   账号：登录 / 注册页、右上角账号区、家长视图、账号管理弹窗
   —— 服务器版（部署到网址上）用；离线版（双击 index.html）看不到这些。
   ======================================================================= */

/* ---------- 登录 / 注册（挡在整页最前面） ---------- */
.auth-screen {
  position: fixed; inset: 0; z-index: 400;
  background: linear-gradient(180deg, #eef2f9 0%, #e7ecf6 100%);
  overflow: auto; padding: 34px 16px 40px;
  display: flex; justify-content: center; align-items: flex-start;
}
body.is-guest { overflow: hidden; }

.auth-card {
  width: 100%; max-width: 420px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 22px 22px 18px;
}
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.auth-brand-text { display: flex; flex-direction: column; line-height: 1.35; }
.auth-brand-text b { font-size: 17px; color: var(--ink); }
.auth-brand-text span { font-size: 12.5px; color: var(--ink-3); }

.auth-tabs {
  display: flex; gap: 3px; padding: 3px; margin-bottom: 16px;
  background: #f1f4f9; border-radius: 11px;
}
.auth-tab {
  flex: 1; padding: 8px 0; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink-2);
  font-family: inherit; font-size: 14px; cursor: pointer;
}
.auth-tab.is-active {
  background: #fff; color: var(--primary); font-weight: 700;
  box-shadow: 0 1px 2px rgba(20, 33, 55, .08);
}

.auth-form .field { margin-bottom: 12px; }
.auth-role { display: flex; gap: 8px; margin-bottom: 14px; }
.auth-role-btn {
  flex: 1; padding: 9px 0; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  font-family: inherit; font-size: 14px;
}
.auth-role-btn.is-active {
  border-color: var(--primary); background: var(--primary-soft);
  color: var(--primary-dark); font-weight: 700;
}
.auth-tip {
  margin: 0 0 12px; padding: 8px 11px; border-radius: 10px;
  background: var(--primary-soft); color: #2a4a86;
  font-size: 12.5px; line-height: 1.6;
}
.auth-remember {
  display: flex; align-items: center; gap: 7px;
  margin: 2px 0 10px; font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.auth-msg { min-height: 17px; margin: 0 0 10px; font-size: 12.5px; color: var(--ink-3); }
.auth-msg.is-err { color: var(--minus); }
.auth-msg.is-ok { color: var(--plus); }
.auth-foot { margin: 14px 0 0; text-align: center; font-size: 13px; color: var(--ink-3); }
.link-btn {
  border: 0; background: none; padding: 0 2px; cursor: pointer;
  color: var(--primary); font-family: inherit; font-size: 13px;
  text-decoration: underline;
}
.auth-note {
  margin: 16px 0 0; text-align: center;
  font-size: 11.5px; color: var(--ink-3); line-height: 1.7;
}

/* ---------- 扫码登录（大屏出码） ---------- */
.qr-panel { text-align: center; }
.qr-title { margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--ink); }
.qr-sub { margin: 0 0 14px; font-size: 12.5px; line-height: 1.7; color: var(--ink-3); }
.qr-frame {
  width: 232px; height: 232px; margin: 0 auto 12px; padding: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 8px 24px -14px rgba(23, 32, 51, .35);
  display: flex; align-items: center; justify-content: center;
}
.qr-frame svg { width: 100%; height: auto; display: block; border-radius: 4px; }
.qr-wait { font-size: 12.5px; color: var(--ink-3); line-height: 1.7; padding: 0 8px; }
.qr-btns { display: flex; gap: 8px; margin-top: 4px; }
.qr-btns .btn { flex: 1; }
@media (max-width: 420px) {
  .qr-frame { width: 208px; height: 208px; }
}

/* ---------- 右上角的「我是谁」 ---------- */
.user-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--primary-soft); border: 1px solid #cddcff;
  font-size: 12.5px; font-weight: 700; color: var(--primary-dark);
  white-space: nowrap;
}
.user-chip .user-role {
  padding: 1px 7px; border-radius: 999px;
  background: #fff; border: 1px solid #cddcff;
  font-size: 11px; font-weight: 700; color: var(--primary-dark);
}
.user-chip.is-parent { background: var(--plus-soft); border-color: #c2e8d8; color: #0f7a51; }
.user-chip.is-parent .user-role { border-color: #c2e8d8; color: #0f7a51; }

/* ---------- 游客视图（班级一体机：只能看，不能改） ---------- */
.user-chip.is-guest { background: #f1f3f7; border-color: #d6dae3; color: #55606f; }
.user-chip.is-guest .user-role { border-color: #d6dae3; color: #55606f; }
/* 动手的按钮、「积分」页签一律藏掉（点也拦得住，这只是不让他看见）；
   工具箱是例外：游客能开早读/自习检测，里面的按钮见下面单独还原 */
body.is-guest-view [data-lock],
body.is-guest-view #btnExport,
body.is-guest-view #btnImportFile,
body.is-guest-view .tab[data-view="score"],
body.is-guest-view #view-score,
body.is-guest-view [data-rset],
body.is-guest-view [data-redit],
body.is-guest-view [data-rdel],
body.is-guest-view [data-petadopt],
body.is-guest-view [data-buy],
body.is-guest-view [data-redeem],
body.is-guest-view [data-petfeed],
body.is-guest-view [data-petduel],
body.is-guest-view [data-useitem],
body.is-guest-view [data-feeditem],
body.is-guest-view [data-txdel],
body.is-guest-view [data-quietundo],
body.is-guest-view [data-readdel],
body.is-guest-view [data-readbonusundo] { display: none !important; }
/* 游客能用工具箱：早读/自习检测的这 10 个按钮还回来（其余 [data-lock] 一律继续藏） */
body.is-guest-view #view-toolbox #btnStartMic,
body.is-guest-view #view-toolbox #btnCalibrate,
body.is-guest-view #view-toolbox #btnStopMic,
body.is-guest-view #view-toolbox #btnResetSession,
body.is-guest-view #view-toolbox #btnQuietStart,
body.is-guest-view #view-toolbox #btnQuietCalibrate,
body.is-guest-view #view-toolbox #btnQuietStop,
body.is-guest-view #view-toolbox #btnQuietReset,
body.is-guest-view #view-toolbox #btnQuietBeep { display: inline-block !important; }
/* 「早读质量达标奖励：给全班加 N 分」不给游客（那是一次性手动加分） */
body.is-guest-view #view-toolbox [data-readbonus] { display: none !important; }

/* ---------- 家长视图 ---------- */
body.is-parent #tabs,
body.is-parent #btnExport,
body.is-parent #btnImportFile,
body.is-parent .auth-warn { display: none !important; }
body.is-parent #view-parent { display: block; }
body.is-parent .view:not(#view-parent) { display: none !important; }

.parent-card { padding: 18px 20px 20px; margin-bottom: 14px; }
.parent-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.parent-name { margin: 0; font-size: 20px; color: var(--ink); }
.parent-meta { margin: 0; }
.parent-stats {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
}
.parent-stat {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 13px; background: #fbfcfe;
}
.parent-stat .stat-k {
  font-size: 12px; color: var(--ink-3); margin-bottom: 5px; line-height: 1.5;
}
.parent-pts { font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1.15; }
.parent-rank { font-size: 17px; font-weight: 700; color: var(--ink); }
.parent-rank .muted { font-size: 12px; font-weight: 400; display: inline; margin: 0; }
.parent-lv { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.parent-next { font-size: 12px; color: var(--ink-3); }

.parent-txns { padding: 16px 20px 18px; }
.parent-txns .panel-title { display: flex; align-items: center; gap: 8px; margin: 0; }
.parent-txn-list { display: flex; flex-direction: column; margin-top: 4px; }
.parent-txn {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 0; border-bottom: 1px dashed var(--line);
}
.parent-txn:last-child { border-bottom: 0; }
.pt-amt { font-size: 15px; font-weight: 800; min-width: 42px; }
.pt-amt.is-plus { color: var(--plus); }
.pt-amt.is-minus { color: var(--minus); }
.pt-reason { flex: 1 1 auto; font-size: 13.5px; color: var(--ink); }
.pt-time { font-size: 12px; margin: 0; }
.parent-tip { margin: 10px 0 0; }

/* ---------- 账号管理（老师） ---------- */
.code-row { display: flex; flex-wrap: wrap; gap: 10px; }
.code-box {
  flex: 1 1 190px; display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: #fbfcfe;
}
.code-k { font-size: 12px; color: var(--ink-3); flex: 1 1 auto; }
.code-v {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 17px; letter-spacing: 1.5px; color: var(--primary-dark);
}
.acc-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.acc-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff;
}
.acc-main { flex: 1 1 220px; min-width: 0; }
.acc-login { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.acc-role {
  margin-left: 7px; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}
.acc-role.is-teacher { background: var(--primary-soft); color: var(--primary-dark); }
.acc-role.is-parent { background: var(--plus-soft); color: #0f7a51; }
.acc-me {
  margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  background: #eef1f6; color: var(--ink-2); font-size: 11px;
}
.acc-off {
  margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  background: var(--minus-soft); color: var(--minus); font-size: 11px; font-weight: 700;
}
.acc-sub { font-size: 12px; margin: 3px 0 0; line-height: 1.5; }
.acc-sub.muted { font-size: 12px; margin: 2px 0 0; }
.acc-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.acc-rebind {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 10px;
  border: 1px dashed var(--primary); border-radius: 12px;
  background: var(--primary-soft); font-size: 13px; color: #2a4a86;
}
.acc-rebind .select { flex: 1 1 140px; }
.btn-danger { color: var(--minus); border-color: #f0b6b3; }
.btn-danger:hover { background: var(--minus-soft); border-color: var(--minus); }

/* ---------- 手机上再收一收 ---------- */
@media (max-width: 640px) {
  .auth-screen { padding: 18px 12px 30px; }
  .auth-card { padding: 18px 16px 14px; border-radius: 16px; }
  .parent-stats { grid-template-columns: 1fr; }
  .parent-card { padding: 15px 15px 17px; border-radius: 14px; }
  .parent-txns { padding: 14px 15px 15px; border-radius: 14px; }
  .acc-row { align-items: flex-start; padding: 10px 11px; }
  .acc-ops { width: 100%; gap: 8px; }
  .acc-ops .btn { flex: 1 1 calc(50% - 4px); min-width: 0; font-size: 13.5px; padding: 8px 8px; }
  .code-box { flex: 1 1 100%; }

  /* 全班目标 + 排行榜切换在窄屏上别挤 */
  .goal-top { padding: 13px 14px 0; }
  .goal-now { font-size: 26px; }
  .goal-since { margin-left: 0; width: 100%; }
  .goal-bar { margin: 9px 14px 0; }
  .goal-foot { padding: 10px 14px 13px; }
  .goal-empty { padding: 14px 14px 16px; }
  .rank-seg { margin: 10px 14px 2px; }
}




/* ======================================================================
   v2 视觉升级（2026-10-18）
   只加样式，不改结构；所有规则放在文件最后，覆盖前面的旧样式。
   ====================================================================== */

:root {
  --bg: #eef1f7;
  --ink: #17202e;
  --ink-2: #566174;
  --ink-3: #8b96a8;
  --line: #e4e9f2;
  --line-2: #d3dae7;
  --primary: #2f6bff;
  --primary-soft: #edf2ff;
  --plus: #0f9d68;
  --minus: #e0564e;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(18, 28, 45, .05), 0 6px 16px -12px rgba(18, 28, 45, .2);
  --shadow: 0 1px 2px rgba(18, 28, 45, .05), 0 18px 40px -26px rgba(18, 28, 45, .35);
}

body {
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -6%, #dfe8ff 0%, rgba(223, 232, 255, 0) 62%),
    radial-gradient(760px 360px at 100% 0%, #e7f6ef 0%, rgba(231, 246, 239, 0) 58%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1480px; padding: 24px 28px 44px; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid rgba(228, 233, 242, .9);
}
.topbar-inner {
  max-width: 1480px;
  padding: 12px 28px;
  gap: 18px;
  flex-wrap: wrap;
}
.brand { gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  font-size: 19px; font-weight: 800; color: #fff;
  background: linear-gradient(145deg, #5f8dff, #2f6bff 55%, #2453d6);
  box-shadow: 0 8px 18px -8px rgba(47, 107, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.class-name {
  font-size: 16px; font-weight: 750; letter-spacing: .01em;
  border: 1px solid transparent; border-radius: 8px; padding: 1px 5px; margin-left: -5px;
  background: transparent;
}
.class-name:hover, .class-name:focus { background: #fff; border-color: var(--line-2); outline: none; }
.brand-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.brand-sub b { color: var(--ink-2); font-weight: 650; }

.tabs {
  display: flex; gap: 4px; padding: 4px;
  background: #eef2f8; border: 1px solid #e7ecf4; border-radius: 14px;
}
.tab {
  padding: 8px 16px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  border: 0; background: transparent;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--ink); }
.tab.is-active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(20, 33, 55, .12); }

.topbar-actions { gap: 8px; }
.topbar-actions .btn { border-radius: 10px; }
.lock-hint, .auth-chip {
  border-radius: 999px; padding: 7px 13px; font-size: 12.5px; font-weight: 600;
  background: #fff6e5; color: #9a6a13; border: 1px solid #f6e3bf;
}
.auth-chip { background: #eaf2ff; color: #2453c8; border-color: #d8e4ff; }
.user-chip { border-radius: 999px; padding: 6px 12px; background: #f2f6fc; }

/* ---------- 卡片 / 标题 / 按钮 / 输入 ---------- */
.card {
  background: #fff;
  border: 1px solid #e6ebf4;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}
.card-head { padding: 16px 20px; border-bottom: 1px solid #eef2f8; }
.panel-title { font-size: 15.5px; font-weight: 750; letter-spacing: .01em; }
.panel-hint, .tool-sub, .muted { color: var(--ink-3); font-size: 12.5px; }

.btn {
  border-radius: 11px; font-weight: 650; letter-spacing: .01em;
  transition: transform .12s, box-shadow .15s, background .15s, border-color .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-sm { border-radius: 10px; }
.btn-primary {
  background: linear-gradient(145deg, #4b7fff, #2f6bff 60%, #2453d6);
  border-color: #2f6bff;
  box-shadow: 0 10px 20px -12px rgba(47, 107, 255, .95);
}
.btn-plus {
  background: linear-gradient(145deg, #22b07c, #0f9d68);
  border-color: #0f9d68; color: #fff;
  box-shadow: 0 10px 20px -12px rgba(15, 157, 104, .9);
}
.btn-minus {
  background: #fff; border: 1px solid #f2c6c2; color: var(--minus);
  box-shadow: none;
}
.btn-minus:hover { background: #fdf3f2; border-color: #e9a8a3; }
.btn-ghost { background: #f5f7fb; border-color: #e8edf5; color: var(--ink-2); }
.btn-ghost:hover { background: #eef2f9; color: var(--ink); }

input[type="text"], input[type="number"], input[type="search"],
input[type="password"], input[type="date"], select, .search, .select {
  border: 1px solid var(--line-2);
  border-radius: 11px;
  background: #fff;
  padding: 9px 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, .search:focus, .select:focus {
  border-color: #9db9ff; outline: none;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .13);
}
.pill {
  border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600;
  background: var(--primary-soft); color: #2c5ad6;
}
.pill-btn { cursor: pointer; border: 1px solid #dbe6fb; background: #f2f6ff; color: var(--primary); }
.pill-btn:hover { background: #e8f0ff; }

/* ---------- 积分页：概览条 ---------- */
.score-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat {
  position: relative; overflow: hidden;
  background: #fff; border: 1px solid #e6ebf4; border-radius: 18px;
  padding: 15px 18px 14px;
  box-shadow: var(--shadow-sm);
}
.stat::after {
  content: ""; position: absolute; right: -34px; top: -46px;
  width: 128px; height: 128px; border-radius: 50%;
  background: radial-gradient(circle, #e9f0ff 0%, rgba(233, 240, 255, 0) 70%);
  pointer-events: none;
}
.stat-k { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.stat-v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-top: 5px; line-height: 1.15; }
.stat-v small { font-size: 13px; font-weight: 650; color: var(--ink-3); margin-left: 4px; }
.stat-note { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.stat-note b { color: var(--ink-2); }

/* ---------- 积分页：左右布局 ---------- */
.score-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.score-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.score-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 88px; }

.score-panel {
  background: #fff; border: 1px solid #e6ebf4; border-radius: 20px;
  padding: 18px 20px 20px;
  box-shadow: var(--shadow-sm);
}
.score-panel-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; flex-wrap: wrap; margin-bottom: 13px;
}
.selection-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quick {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-radius: 13px;
  background: #f8fafd; border: 1px solid #e8edf5;
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  text-align: left; transition: border-color .15s, box-shadow .15s, background .15s;
}
.quick:hover { background: #fff; border-color: #bcd0ff; box-shadow: 0 10px 22px -18px rgba(47, 107, 255, .8); }
.quick-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.quick-val { font-weight: 750; color: var(--plus); flex: 0 0 auto; }
.quick.is-minus .quick-val { color: var(--minus); }
.score-form {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
  margin-top: 13px; padding-top: 13px; border-top: 1px dashed #e8edf5;
}
.score-form .field { margin: 0; }
.score-form .field-grow { flex: 1 1 260px; }
.score-form .btn { padding: 10px 26px; }
.score-form .btn-plus { flex: 0 0 auto; }

/* ---------- 积分页：工具栏 / 学生卡 ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .search { flex: 1 1 240px; min-width: 0; }
.toolbar .select { min-width: 0; }
.toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
  gap: 12px;
}
.student {
  position: relative;
  background: #fff; border: 1px solid #e8edf5; border-radius: 16px;
  padding: 20px 18px 16px;
  box-shadow: 0 1px 2px rgba(18, 28, 45, .04);
  cursor: pointer;
  transition: transform .14s, box-shadow .16s, border-color .16s, background .16s;
}
.student:hover {
  transform: translateY(-1px);
  border-color: #bcd0ff;
  box-shadow: 0 18px 30px -22px rgba(47, 107, 255, .55);
}
.student.is-selected {
  border-color: var(--primary);
  background: #fbfdff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .14), 0 12px 24px -18px rgba(47, 107, 255, .6);
}
.st-medal {
  position: absolute; top: -9px; left: 14px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 750; letter-spacing: .02em;
  background: linear-gradient(145deg, #ffe7a3, #ffc94d); color: #7a5200;
  box-shadow: 0 2px 6px rgba(217, 154, 18, .25);
}
.st-medal.m2 { background: linear-gradient(145deg, #f4f7fb, #d3dce8); color: #4b5a6c; box-shadow: 0 2px 6px rgba(90, 105, 125, .2); }
.st-medal.m3 { background: linear-gradient(145deg, #f8ddc4, #e5a874); color: #7a3f12; box-shadow: 0 2px 6px rgba(160, 95, 40, .22); }
.st-body { display: flex; align-items: center; gap: 12px; }
.st-ava {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 750; color: #fff;
  background: linear-gradient(145deg, #8fb0ff, #3f74ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4);
}
.st-ava.a2 { background: linear-gradient(145deg, #ffd08a, #f0a63c); }
.st-ava.a3 { background: linear-gradient(145deg, #7fdcb4, #17a06b); }
.st-ava.a4 { background: linear-gradient(145deg, #c9a8ff, #8155e0); }
.st-ava.a5 { background: linear-gradient(145deg, #b9c4d6, #7d8ba1); }
.st-main { flex: 1 1 auto; min-width: 0; }
.st-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.st-name {
  font-size: 15px; font-weight: 750; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.st-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.st-group { background: #f0f4fa; border-radius: 6px; padding: 1px 6px; color: #6b7689; font-weight: 600; }
.st-pts { flex: 0 0 auto; text-align: right; }
.st-points { font-size: 27px; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: var(--primary); }
.st-points.plus, .st-points.pos { color: var(--plus); }
.st-points.minus, .st-points.neg { color: var(--minus); }
.st-pts-k { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.st-level-line {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed #e8edf5;
  font-size: 12px; color: var(--ink-3); padding-right: 66px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.st-actions {
  position: absolute; right: 12px; bottom: 9px;
  display: flex; gap: 6px; opacity: 0; transition: opacity .16s;
}
.student:hover .st-actions, .student.is-selected .st-actions { opacity: 1; }
.st-btn {
  width: 27px; height: 27px; border-radius: 9px;
  border: 1px solid #e2e8f2; background: #fff;
  font-size: 15px; font-weight: 750; line-height: 1; color: var(--ink-2);
  display: grid; place-items: center;
  transition: background .14s, border-color .14s, color .14s;
}
.st-btn.plus:hover { background: #e8f8f1; border-color: #9fdcbf; color: var(--plus); }
.st-btn.minus:hover { background: #fdeeed; border-color: #f0b9b4; color: var(--minus); }

/* ---------- 积分页：右栏 ---------- */
.side-card { overflow: hidden; }
.side-card .card-head {
  padding: 14px 16px; border-bottom: 1px solid #eef2f8;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
.side-card .panel-title { font-size: 14.5px; }
.podium-list { padding: 4px 0; }
.pd {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid #f2f5fa;
}
.pd:last-child { border-bottom: 0; }
.pd-no {
  width: 24px; height: 24px; flex: 0 0 auto; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 750; color: #6b7689; background: #f3f6fb;
}
.pd:nth-child(1) .pd-no { background: linear-gradient(145deg, #ffe7a3, #ffc94d); color: #7a5200; }
.pd:nth-child(2) .pd-no { background: linear-gradient(145deg, #f4f7fb, #d3dce8); color: #4b5a6c; }
.pd:nth-child(3) .pd-no { background: linear-gradient(145deg, #f8ddc4, #e5a874); color: #7a3f12; }
.pd-name { flex: 1 1 auto; min-width: 0; font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-pts { font-weight: 750; font-size: 14px; color: var(--primary); }
.week-bars { display: flex; flex-direction: column; gap: 9px; padding: 13px 16px 15px; }
.wb-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.wb-k { width: 42px; flex: 0 0 auto; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-track { flex: 1 1 auto; height: 7px; border-radius: 999px; background: #eef2f8; overflow: hidden; }
.wb-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #34c08a, #0f9d68); }
.wb-fill.blue { background: linear-gradient(90deg, #6b9bff, #2f6bff); }
.wb-val { width: 26px; flex: 0 0 auto; text-align: right; color: var(--ink-3); font-weight: 600; }
.tip-card {
  border: 0; padding: 18px 18px 20px; color: #fff;
  background: linear-gradient(150deg, #4f7dff, #2f5fe0 58%, #2549b8);
  box-shadow: 0 20px 40px -26px rgba(37, 73, 184, .8);
}
.tip-k { font-size: 12px; font-weight: 600; opacity: .8; }
.tip-t { font-size: 19px; font-weight: 800; line-height: 1.35; margin: 6px 0 8px; letter-spacing: .01em; }
.tip-p { font-size: 12px; line-height: 1.75; opacity: .86; margin: 0; }
.tip-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  padding: 8px 14px; border-radius: 10px; font-size: 12.5px; font-weight: 650;
  background: rgba(255, 255, 255, .16); color: #fff; border: 1px solid rgba(255, 255, 255, .28);
  cursor: pointer;
}
.tip-link:hover { background: rgba(255, 255, 255, .24); }

/* ---------- 排行页 ---------- */
.goal-card { padding: 18px 20px; }
.goal-bar { height: 10px; border-radius: 999px; background: #eef2f8; overflow: hidden; }
.goal-fill { background: linear-gradient(90deg, #34c08a, #0f9d68); }
.group-grid { gap: 12px; }
.group-card {
  border-radius: 16px; border: 1px solid #e8edf5; background: #fff;
  padding: 15px 16px;
  box-shadow: 0 1px 2px rgba(18, 28, 45, .04);
  transition: transform .14s, box-shadow .16s, border-color .16s;
}
.group-card:hover { transform: translateY(-1px); border-color: #bcd0ff; box-shadow: 0 16px 28px -22px rgba(47, 107, 255, .5); }
.group-card.top-g { border-color: #f0d9a4; background: linear-gradient(180deg, #fffdf6, #fff); }
.group-total { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.rank-list { gap: 8px; }
.rank-row {
  border: 1px solid #e8edf5; border-radius: 14px; background: #fff;
  padding: 11px 14px;
  transition: border-color .15s, box-shadow .15s;
}
.rank-row:hover { border-color: #bcd0ff; box-shadow: 0 12px 24px -20px rgba(47, 107, 255, .55); }
.rank-row.top1 { border-color: #f0d9a4; background: linear-gradient(180deg, #fffdf6, #fff); }
.rank-row.top2 { border-color: #dde4ee; background: linear-gradient(180deg, #fafbfd, #fff); }
.rank-row.top3 { border-color: #f0ddcb; background: linear-gradient(180deg, #fffbf7, #fff); }
.rank-no {
  width: 30px; height: 30px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 750; background: #f3f6fb; color: #6b7689;
}
.rank-no.m1 { background: linear-gradient(145deg, #ffe7a3, #ffc94d); color: #7a5200; }
.rank-no.m2 { background: linear-gradient(145deg, #f4f7fb, #d3dce8); color: #4b5a6c; }
.rank-no.m3 { background: linear-gradient(145deg, #f8ddc4, #e5a874); color: #7a3f12; }
.rank-bar { height: 8px; border-radius: 999px; background: #eef2f8; overflow: hidden; }
.rank-bar-fill { border-radius: 999px; background: linear-gradient(90deg, #6b9bff, #2f6bff); }
.rank-bar-fill.plus { background: linear-gradient(90deg, #34c08a, #0f9d68); }
.rank-pts { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.rank-name { font-size: 14.5px; font-weight: 700; }

/* ---------- 宠物页 ---------- */
.pet-grid { grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px; }
.pet-card {
  border: 1px solid #e8edf5; border-radius: 18px; background: #fff;
  box-shadow: 0 1px 2px rgba(18, 28, 45, .04);
  transition: transform .14s, box-shadow .16s, border-color .16s;
}
.pet-card:hover { transform: translateY(-1px); border-color: #bcd0ff; box-shadow: 0 18px 30px -22px rgba(47, 107, 255, .5); }
.pet-bar { height: 8px; border-radius: 999px; background: #eef2f8; overflow: hidden; }
.pet-bar span { background: linear-gradient(90deg, #6b9bff, #2f6bff); }
.pet-bar.mood span { background: linear-gradient(90deg, #ffcf7a, #f0a63c); }
.mini { border-radius: 9px; }

/* ---------- 商店页 ---------- */
.shop-page { padding: 16px 20px 20px; }
.shop-top {
  background: #f8fafd; border: 1px solid #e8edf5; border-radius: 16px;
  padding: 12px 16px;
}
.shop-card {
  border: 1px solid #e8edf5; border-radius: 14px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.shop-card:hover { border-color: #bcd0ff; box-shadow: 0 12px 24px -20px rgba(47, 107, 255, .5); }
.shop-col { border-radius: 14px; }
.btn-buy { border-radius: 10px; }

/* ---------- 表格 / 弹窗 / 空态 ---------- */
.table th { background: #f7f9fd; color: var(--ink-2); font-weight: 650; }
.table tbody tr:hover { background: #f8fafd; }
.modal-card { border-radius: 22px; box-shadow: 0 30px 80px -30px rgba(15, 25, 45, .45); }
.empty {
  border: 2px dashed #dbe3ef; border-radius: 18px; background: rgba(255, 255, 255, .6);
}
.auth-warn {
  border-radius: 14px; background: #fff7e8; border: 1px solid #f6e3bf; color: #8a5d10;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .score-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-layout { grid-template-columns: minmax(0, 1fr); }
  .score-side { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-side .tip-card { grid-column: 1 / -1; }
}
@media (max-width: 780px) {
  .wrap { padding: 14px 14px 30px; }
  .topbar-inner { padding: 10px 14px; gap: 10px; }
  .tabs { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; }
  .score-stats { gap: 10px; }
  .stat { padding: 12px 14px; border-radius: 15px; }
  .stat-v { font-size: 24px; }
  .score-side { grid-template-columns: minmax(0, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-form .btn { flex: 1 1 120px; }
  .student-grid { grid-template-columns: minmax(0, 1fr); }
  .student { padding: 16px 16px 14px; }
  .st-points { font-size: 24px; }
  .toolbar .search { flex: 1 1 100%; }
  .toolbar-right { margin-left: 0; }
  .score-panel { padding: 15px 16px 16px; }
}

/* 锁定态默认样式覆盖（.btn.btn-plus 优先级更高，这里补回来） */
.btn.btn-plus{background:linear-gradient(145deg,#22b07c,#0f9d68);border-color:#0f9d68;color:#fff;}
.btn.btn-plus:hover:not(:disabled){background:linear-gradient(145deg,#1ba873,#0c8b5b);border-color:#0c8b5b;}
.btn.btn-minus{background:#fff;border:1px solid #f2c6c2;color:#e0564e;}
.btn.btn-minus:hover:not(:disabled){background:#fdf3f2;border-color:#e9a8a3;}
.wb-k{width:52px;}

/* ================= v2 补丁：宠物 / 工具箱 / 表格 / 分段控件 ================= */
.pet-grid { grid-template-columns: repeat(auto-fill, minmax(278px, 1fr)); }
.pet-card { padding: 16px 16px 14px; }
.pet-card-top { display: flex; align-items: center; gap: 11px; }
.pet-emoji {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center; font-size: 28px;
  background: linear-gradient(145deg, #f2f6fd, #e7eefb);
  border: 1px solid #e3eaf6;
  box-shadow: inset 0 1px 0 #fff;
}
.pet-name { font-size: 15px; font-weight: 750; }
.pet-owner { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.pet-lv {
  font-size: 11.5px; font-weight: 700; color: var(--primary);
  background: var(--primary-soft); border-radius: 999px; padding: 3px 9px;
}
.pet-stage { font-size: 12.5px; color: var(--ink-2); }
.pet-bar-labels { font-size: 11.5px; color: var(--ink-3); }
.pet-card-actions { gap: 7px; }
.pet-card-actions .mini {
  padding: 7px 14px; font-size: 12.5px; font-weight: 600;
  border-radius: 10px; border: 1px solid #e2e8f2; background: #f8fafd; color: var(--ink-2);
}
.pet-card-actions .mini:hover { background: #eef3fb; border-color: #c9d8f2; color: var(--primary); }

.tool-hub-grid { gap: 12px; }
.tool-hub-card {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 18px 20px; border-radius: 18px;
  border: 1px solid #e8edf5; background: #fff;
  box-shadow: 0 1px 2px rgba(18, 28, 45, .04);
  transition: transform .14s, box-shadow .16s, border-color .16s;
  text-align: left;
}
.tool-hub-card:hover {
  transform: translateY(-1px); border-color: #bcd0ff;
  box-shadow: 0 18px 30px -22px rgba(47, 107, 255, .5);
}
.tool-hub-card .tool-icon {
  flex: 0 0 auto; width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center; font-size: 24px;
  background: linear-gradient(145deg, #f2f6fd, #e8eefb);
  border: 1px solid #e3eaf6;
}
.tool-hub-name { font-size: 15px; font-weight: 750; }
.tool-hub-desc { font-size: 12.5px; color: var(--ink-3); line-height: 1.65; }
.tool-hub-go { font-size: 12.5px; font-weight: 650; color: var(--primary); }
.tool-hub-badge {
  font-size: 11px; font-weight: 650; color: #2c5ad6;
  background: var(--primary-soft); border-radius: 999px; padding: 2px 8px;
  vertical-align: 1px;
}

/* 表格：表头吸顶 + 行悬浮 */
.table thead th { position: sticky; top: 0; z-index: 1; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f7faff; }
.card > .table { border-radius: 0 0 20px 20px; }

/* 排行页的「总分排行 / 本周进步」分段控件按内容宽度 */
#rankModeSeg { display: inline-flex; width: auto; align-self: flex-start; }
#rankModeSeg .seg-item { flex: 0 0 auto; padding: 8px 22px; }

/* 积分页右侧小提示里的按钮间距 */
.tip-card .tip-link + .tip-link { margin-left: 8px; }

@media (max-width: 780px) {
  .pet-grid { grid-template-columns: minmax(0, 1fr); }
  .tool-hub-card { padding: 15px 16px; }
}

.tool-hub-card .tool-hub-name { display: block; }
.tool-hub-card .tool-hub-desc { display: block; margin-top: 3px; }
.tool-hub-card .tool-hub-go { display: block; margin-top: 5px; }

@media (max-width: 780px) {
  .topbar-actions { width: 100%; flex-wrap: wrap; gap: 6px; }
  /* 一行四颗平分宽度：之前写 flex:0 0 auto 会让按钮挤到右边、左边空一大块 */
  .topbar-actions .btn { flex: 1 1 0; min-width: 0; padding: 7px 4px; font-size: 12.5px; }
  .lock-hint, .auth-chip { font-size: 12px; padding: 6px 10px; }
  .tab { padding: 7px 13px; font-size: 12.5px; }
}
.codex-name .custom-flag,
.codex-name .hidden-flag {
  font-size: 12px;
  padding: 2px 8px;
  margin-left: 8px;
  vertical-align: 6px;
}

/* ==================================================================
   v3 —— 手机 / 一体机的主流程：选中 → 加分
   The 44px Finger Rule：卡片上的 ± 从 27×27 长到 ≥44×44，并直接写出分值；
   The One-Screen Rule：选中之后底部常驻一条操作条，不用滚回顶部。
   ================================================================== */

/* 卡片上的 ± ：常显（触屏没有 hover），44 宽、带分值；
   原来的 border-top/padding-top 是「按钮排在段位行下面」时代的，绝对定位后会在
   「积分」两个字中间压出一条横线，这里一并清掉；右边缘对齐数字（卡片内边距 16） */
.st-actions {
  right: 16px; bottom: 8px; gap: 8px; opacity: 1;
  border-top: 0; padding-top: 0; margin-top: 0;
}
.st-btn {
  width: auto; min-width: 44px; height: 44px;
  padding: 0 9px; border-radius: 12px;
  font-size: 14px; font-weight: 750; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.st-btn.plus { background: #f2fbf6; border-color: #cdeadd; color: #0f9d68; }
.st-btn.minus { background: #fdf4f3; border-color: #f2d3d0; color: #e0564e; }
.st-btn.plus:hover, .st-btn.plus:active { background: #e6f8ef; border-color: #9fdcbf; }
.st-btn.minus:hover, .st-btn.minus:active { background: #fdeeed; border-color: #f0b9b4; }
/* ± 长到 44 之后，段位行整条（含虚线）都要让路：用 margin 让虚线在按钮左边就收住 */
.st-level-line { padding-right: 0; margin-right: 110px; }

/* 底部常驻操作条 */
.sticky-acts {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 30px -22px rgba(15, 25, 45, .45);
}
.sticky-acts[hidden] { display: none; }
.sa-info { flex: 1 1 auto; min-width: 0; }
.sa-line {
  font-size: 13.5px; font-weight: 750; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sa-amt { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-btns { flex: 0 0 auto; display: flex; gap: 8px; }
.sa-btns .btn { height: 46px; padding: 0 16px; font-size: 14.5px; }
.sa-btns .btn-ghost { border: 1px solid #e2e8f2; background: #f5f7fb; color: var(--ink-2); }

/* 操作条占住底部时，页面多留 78px，最后一行卡片不会被压住 */
body.has-sticky-acts #view-score { padding-bottom: 78px; }

@media (max-width: 520px) {
  .sa-info { flex: 1 1 34%; }
  .sa-btns { gap: 6px; }
  .sa-btns .btn { padding: 0 12px; font-size: 14px; }
}
@media (max-width: 380px) {
  .sa-btns .btn-ghost { display: none; }
}


/* ==========================================================================
   v4：名单页（2026-10-18）—— 一行一个人、点开才出操作、破坏性操作收进「···」
   ========================================================================== */
.rbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.rbar .search { flex: 1 1 260px; min-width: 0; }
.rbar .select { flex: 0 0 auto; }
.rbar-add { flex: 0 0 auto; }
.rmore { position: relative; flex: 0 0 auto; }
.rmore-btn { min-width: 44px; padding: 0 10px; font-size: 17px; font-weight: 800; letter-spacing: .5px; line-height: 1; }
.rmore-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 80;
  min-width: 216px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  background: #fff; border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(18,28,45,.05), 0 18px 40px -26px rgba(18,28,45,.35);
}
.rmore-menu[hidden] { display: none; }
.rmore-item {
  appearance: none; text-align: left; border: 0; background: transparent; cursor: pointer;
  min-height: 44px; padding: 11px 12px; border-radius: 10px;
  font: inherit; font-size: 13px; font-weight: 650; color: var(--ink-2);
}
.rmore-item:hover { background: #f5f7fb; color: var(--ink); }
.rmore-item.danger { color: var(--minus); }
.rmore-item.danger:hover { background: #fdf4f3; }
.rmore-item:disabled { opacity: .45; cursor: not-allowed; }
.rmore-sep { height: 1px; margin: 4px 6px; background: var(--line); }

.rcard { padding: 0; overflow: hidden; }
.rlist { display: flex; flex-direction: column; }
.rrow {
  appearance: none; display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 56px; padding: 9px 16px; text-align: left; font: inherit; cursor: pointer;
  background: transparent; border: 0; border-bottom: 1px dashed #eef1f7;
}
.rrow:last-child { border-bottom: 0; }
.rrow:hover { background: #f8fbff; }
.rrow:active { background: #f1f6ff; }
.rrow-idx {
  flex: 0 0 auto; width: 20px; text-align: right;
  font-size: 11.5px; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.ravatar {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: 13.5px; font-weight: 800;
  background: linear-gradient(145deg, #8fb0ff, #3f74ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4);
}
.ravatar.a2 { background: linear-gradient(145deg, #ffd08a, #f0a63c); }
.ravatar.a3 { background: linear-gradient(145deg, #7fdcb4, #17a06b); }
.ravatar.a4 { background: linear-gradient(145deg, #c9a8ff, #8155e0); }
.ravatar.a5 { background: linear-gradient(145deg, #b9c4d6, #7d8ba1); }
.rrow-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rrow-line { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.rrow-name { font-size: 14px; font-weight: 750; color: var(--ink); }
.rrow-pet {
  font-size: 11px; font-weight: 650; color: #8a6b3f;
  background: #fdf6e9; border: 1px solid #f2e3c6; border-radius: 999px; padding: 1px 7px;
}
.rrow-nopet { font-size: 11px; color: var(--ink-3); }
.rrow-sub { font-size: 11.5px; color: var(--ink-3); }
.rrow-pts {
  flex: 0 0 auto; margin-left: auto;
  font-size: 20px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.rrow-pts.c0 { color: var(--ink-3); }
.rrow-pts.c1 { color: var(--primary); }
.rrow-pts.c2 { color: var(--plus); }
.rrow-pts.c3 { color: #c88a12; }
.rrow-chev { flex: 0 0 auto; font-size: 20px; line-height: 1; color: #c2cbdb; padding-left: 2px; }
.rempty { padding: 44px 18px; text-align: center; font-size: 13px; color: var(--ink-3); }
.rsum {
  display: flex; flex-wrap: wrap; gap: 14px; padding: 11px 16px;
  border-top: 1px solid var(--line); background: #f8fafd;
  font-size: 11.5px; color: var(--ink-3);
}

/* 学生操作弹窗 */
.act-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.act {
  appearance: none; min-height: 52px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line-2); background: #fff;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.act b { font-weight: 800; }
.act:hover { border-color: #c9d6ea; background: #f8fbff; color: var(--ink); }
.act.danger { color: var(--minus); border-color: #f2d3d0; background: #fdf8f7; }
.act:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 640px) {
  .rbar .search { flex: 1 1 100%; }
  .rbar .select { flex: 1 1 auto; min-width: 0; }
  .rrow { padding: 9px 13px; gap: 9px; }
  .act-grid { grid-template-columns: repeat(2, 1fr); }
}
/* v4.1：名单行改成网格——手机两行（姓名 / 小组·学号·宠物），桌面八列（#/头像/姓名/小组/学号/宠物/积分/›） */
.rrow {
  display: grid; align-items: center; column-gap: 10px; row-gap: 1px;
  grid-template-columns: 20px 34px minmax(0, 1fr) auto 18px;
  grid-template-areas: "idx ava name pts chev" "idx ava meta pts chev";
  padding: 9px 16px; min-height: 56px;
}
.rrow-idx { grid-area: idx; }
.ravatar { grid-area: ava; }
.rrow-name { grid-area: name; font-size: 14px; font-weight: 750; color: var(--ink); }
.rrow-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rrow-group, .rrow-sid { font-size: 11.5px; color: var(--ink-3); }
.rrow-pts { grid-area: pts; margin-left: 0; text-align: right; }
.rrow-chev { grid-area: chev; }
.rlist-head { display: none; }

@media (min-width: 900px) {
  .rlist-head {
    display: grid; align-items: center; column-gap: 12px; padding: 9px 16px;
    grid-template-columns: 26px 34px minmax(120px, 1.5fr) 110px 90px 160px 90px 18px;
    font-size: 11px; font-weight: 700; color: var(--ink-3);
    background: #f8fafd; border-bottom: 1px solid var(--line);
  }
  .rlist-head-pts { text-align: right; }
  .rrow {
    column-gap: 12px; padding: 8px 16px; min-height: 52px;
    grid-template-columns: 26px 34px minmax(120px, 1.5fr) 110px 90px 160px 90px 18px;
    grid-template-areas: "idx ava name group sid pet pts chev";
  }
  .rrow-meta { display: contents; }
  .rrow-group { grid-area: group; font-size: 12px; color: var(--ink-2); }
  .rrow-sid { grid-area: sid; font-size: 12px; color: var(--ink-3); }
  .rrow-pet { grid-area: pet; justify-self: start; }
  .rrow-nopet { grid-area: pet; justify-self: start; font-size: 11.5px; }
  .rrow-pts { font-size: 19px; }
  .rrow-chev { padding-left: 0; }
}
/* v4.2：桌面八列再加一个弹性空列，让姓名/小组/学号/宠物靠左排、积分贴右，中间留白而不是把姓名和小组拉开 900px */
@media (min-width: 900px) {
  .rlist-head {
    grid-template-columns: 26px 34px minmax(160px, 280px) 100px 80px 180px minmax(0, 1fr) 90px 18px;
  }
  .rrow {
    grid-template-columns: 26px 34px minmax(160px, 280px) 100px 80px 180px minmax(0, 1fr) 90px 18px;
    grid-template-areas: "idx ava name group sid pet . pts chev";
  }
}
/* ==========================================================================
   v5：记录页（2026-10-18）—— 日期分组 + 时间轴行，筛选改成胶囊
   ========================================================================== */
.hbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.hbar .search { flex: 1 1 260px; min-width: 0; }
.hchips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.hseg { flex: 0 0 auto; }
.hchips .pill { margin-left: 2px; }
.hclear { margin-left: auto; }
.hcard { padding: 0; overflow: hidden; }
.hlist-wrap { display: flex; flex-direction: column; }

.hgroup + .hgroup { border-top: 1px solid var(--line); }
.hgroup-h {
  display: flex; align-items: baseline; gap: 8px;
  padding: 10px 16px 6px; background: #f8fafd;
  border-bottom: 1px solid var(--line);
}
.hgroup-day { font-size: 12px; font-weight: 750; color: var(--ink-2); letter-spacing: .01em; }
.hgroup-n { font-size: 11px; color: var(--ink-3); }

.hlist { display: flex; flex-direction: column; }
.hrow {
  display: grid; align-items: center; column-gap: 10px;
  grid-template-columns: 42px 28px minmax(0, 1fr) auto auto;
  padding: 8px 16px; min-height: 52px; cursor: pointer;
  border-bottom: 1px dashed #eef1f7;
}
.hrow:last-child { border-bottom: 0; }
.hrow:hover { background: #f8fbff; }
.hrow-time {
  font-size: 11.5px; font-weight: 650; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.havatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 12px; font-weight: 800;
  background: linear-gradient(145deg, #8fb0ff, #3f74ff);
}
.havatar.a2 { background: linear-gradient(145deg, #ffd08a, #f0a63c); }
.havatar.a3 { background: linear-gradient(145deg, #7fdcb4, #17a06b); }
.havatar.a4 { background: linear-gradient(145deg, #c9a8ff, #8155e0); }
.havatar.a5 { background: linear-gradient(145deg, #b9c4d6, #7d8ba1); }
.hrow-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hrow-name { font-size: 13.5px; font-weight: 750; color: var(--ink); }
.hrow-reason {
  font-size: 11.5px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hpill {
  min-width: 44px; padding: 3px 9px; border-radius: 999px; text-align: center;
  font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.hpill.plus { color: var(--plus); background: var(--plus-soft, #e6f7f0); }
.hpill.minus { color: var(--minus); background: var(--minus-soft, #fdeceb); }
/* v14：记录行显示操作人，桌面端保持单行、手机端另起一行灰字 */
.hrow-by { flex: 0 0 auto; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.hundo {
  appearance: none; min-height: 34px; padding: 0 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line-2); background: #fff;
  font: inherit; font-size: 11.5px; font-weight: 700; color: var(--ink-3);
}
.hundo:hover { border-color: #f2c6c2; color: var(--minus); background: #fdf8f7; }
.hempty { padding: 44px 18px; text-align: center; font-size: 13px; color: var(--ink-3); }

@media (max-width: 520px) {
  .hbar .search { flex: 1 1 100%; }
  .hclear { margin-left: 0; }
  .hrow { grid-template-columns: 38px 26px minmax(0, 1fr) auto auto; column-gap: 8px; padding: 8px 13px; }
  .hpill { min-width: 40px; font-size: 12.5px; padding: 3px 7px; }
  .hundo { padding: 0 8px; }
}
/* v5.1：撤销按钮按 44px 命中区，时间列只放 时:分 */
.hundo { min-height: 44px; min-width: 48px; }
.hrow-time { white-space: nowrap; }
.hrow { min-height: 56px; }
/* v5.2：桌面端记录行改单行（时分 / 头像 / 姓名 + 原因 / 分值 / 撤销），行高从 74 收到 56 */
@media (min-width: 900px) {
  .hrow { min-height: 52px; padding: 4px 16px; grid-template-columns: 46px 28px minmax(0, 1fr) auto auto; }
  .hrow-main { flex-direction: row; align-items: baseline; gap: 10px; overflow: hidden; }
  .hrow-name { flex: 0 0 auto; }
  .hrow-reason { flex: 1 1 auto; min-width: 0; }
  .hgroup-h { padding: 8px 16px 5px; }
}
/* ===== v6：排行页 —— 目标环 + 前三立牌 + 紧凑列表 + 小组横条 ===== */
.rkg-card { padding: 16px 18px 18px; }
.gr-wrap { display: flex; align-items: center; gap: 18px; }
.gring { position: relative; flex: 0 0 auto; width: 92px; height: 92px; border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--p, 0) * 1%), #e7ecf6 0); display: grid; place-items: center; }
.gring::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: #fff; }
.gring-v { position: relative; z-index: 1; font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--primary); }
.gring-v i { font-style: normal; font-size: 11px; font-weight: 700; margin-left: 1px; }
.gring.is-done { background: conic-gradient(var(--plus) 100%, var(--plus) 0); }
.gring.is-done .gring-v { font-size: 30px; }
.ginfo { flex: 1 1 auto; min-width: 0; }
.gtarget { font-size: 25px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.gtarget b { font-weight: 800; }
.gtarget span { margin-left: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.gsub { margin-top: 1px; font-size: 12px; color: var(--ink-3); }
.gfoot { margin-top: 7px; font-size: 13px; color: var(--ink-2); }
.gfoot b { color: var(--ink); }
.gbar { display: none; }
.gacts { margin-top: 10px; }

.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: end; padding: 12px 0 10px; }
.podium:empty { display: none; }
.pod { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 6px 11px;
  border-radius: 14px; background: #f7f9fd; border: 1px solid var(--line); cursor: pointer; min-width: 0;
  transition: transform .12s ease, box-shadow .15s ease; }
.pod:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -14px rgba(18,28,45,.5); }
.pod.p1 { background: #fffdf6; border-color: #f0d08a; padding-top: 13px; box-shadow: 0 2px 10px -7px rgba(176,125,23,.55); }
.pod-medal { font-size: 14px; line-height: 1; }
.rava { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff;
  font-weight: 800; font-size: 16px; background: linear-gradient(145deg, #8fb0ff, #3f74ff); flex: 0 0 auto; }
.rava.a2 { background: linear-gradient(145deg, #ffd08a, #f0a63c); }
.rava.a3 { background: linear-gradient(145deg, #7fdcb4, #17a06b); }
.rava.a4 { background: linear-gradient(145deg, #c9a8ff, #8155e0); }
.rava.a5 { background: linear-gradient(145deg, #b9c4d6, #7d8ba1); }
.pod .rava { width: 44px; height: 44px; font-size: 17px; }
.pod-name { max-width: 100%; font-size: 13.5px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-sub { font-size: 10.5px; color: var(--ink-3); }
.pod-pts { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.pod-pts i { font-style: normal; font-size: 10px; font-weight: 600; color: var(--ink-3); margin-left: 1px; }

.rk-list { display: flex; flex-direction: column; }
.rk { display: grid; grid-template-columns: 26px 36px minmax(0, 1fr) auto auto 12px; align-items: center; gap: 8px;
  min-height: 52px; padding: 4px 6px; border-radius: 11px; cursor: pointer; border-bottom: 1px dashed var(--line); }
.rk:last-child { border-bottom: 0; }
.rk:hover { background: #f5f8ff; }
.rk-no { text-align: center; font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.rk .rava { width: 34px; height: 34px; font-size: 14px; }
.rk-nm { display: flex; flex-direction: column; min-width: 0; font-size: 14px; font-weight: 700; line-height: 1.25; }
.rk-nm em { font-style: normal; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.rk-w { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.rk-w.up { color: var(--plus); }
.rk-w.dn { color: var(--minus); }
.rk-pt { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.rk-chev { text-align: right; font-size: 13px; color: var(--ink-3); }
.rk-more { padding: 9px 0 1px; text-align: center; font-size: 12px; color: var(--ink-3); }

.grp-list { display: flex; flex-direction: column; gap: 13px; padding: 2px 0; }
.grp-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.grp-name { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 750; }
.grp-crown { font-style: normal; font-size: 10px; font-weight: 700; color: #a9761a; background: #fff4d6; border-radius: 999px; padding: 1px 7px; }
.grp-total { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.grp-total i { font-style: normal; font-size: 10px; font-weight: 600; color: var(--ink-3); margin-left: 1px; }
.grp-bar { height: 8px; margin: 6px 0; border-radius: 999px; background: #eef2f8; overflow: hidden; }
.grp-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7fa6ff, #2f6bff); }
.grp.is-top .grp-bar span { background: linear-gradient(90deg, #ffd76e, #f0b429); }
.grp-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; color: var(--ink-3); }
.grp-meta b { color: var(--ink-2); }
.grp-top3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) {
  .grp-meta { flex-direction: column; gap: 2px; }
  .gring { width: 78px; height: 78px; }
  .gring-v { font-size: 19px; }
  .gtarget { font-size: 22px; }
  .rk-w { display: none; }
  .pod-sub { display: none; }
}
/* v6.1：修内边距（.card 本身无 padding，内容块要自己给）与桌面立牌宽度 */
.goal-card .card-head { padding-left: 0; padding-right: 0; border-bottom: 0; padding-bottom: 6px; }
.rkg-card .toolbar-right { flex: 0 0 auto; }
.rkg-card .toolbar-right .btn { flex: 0 0 auto; }
.rk-list { padding: 2px 14px 8px; }
.rk-more { padding: 9px 20px; }
.podium { padding: 14px 20px 6px; justify-items: center; }
.pod { width: 100%; max-width: 220px; }
.grp-list { padding: 14px 20px 18px; }
.grp-meta { min-width: 0; }
.grp-top3 { flex: 0 1 auto; min-width: 0; }
@media (max-width: 560px) {
  .goal-card { padding: 14px 16px 16px; }
  .podium { padding: 10px 14px 4px; gap: 6px; }
  .rk-list { padding: 2px 8px 6px; }
  .grp-list { padding: 12px 16px 16px; }
}
/* v6.2：空目标紧凑左对齐、立牌居中收拢、单位字放大一点 */
.goal-card .rempty, .goal-card .goal-empty { text-align: left; padding: 2px 0 4px; margin: 0; }
.podium { max-width: 760px; margin: 0 auto; }
.grp-total i, .pod-pts i { font-size: 11.5px; margin-left: 2px; }
@media (max-width: 560px) { .podium { max-width: none; } }
/* v6.3：goal-card 头部按钮别拉满（上一版选择器写成了 .rkg-card，没命中） */
.goal-card .card-head { flex-wrap: nowrap; }
.goal-card .card-head .toolbar-right { flex: 0 0 auto; gap: 8px; }
.goal-card .card-head .btn { flex: 0 0 auto; width: auto; }
@media (max-width: 560px) {
  .goal-card .card-head { flex-wrap: wrap; }
  .goal-card .card-head .toolbar-right { width: 100%; justify-content: space-between; }
}
/* v6.4：头部一律单行（标题 + 状态胶囊 + 小按钮），不要拉满整行 */
.rank-card .card-head, .goal-card .card-head { flex-wrap: nowrap; gap: 8px; }
.rank-card .card-head .toolbar-right, .goal-card .card-head .toolbar-right { flex: 0 0 auto; gap: 8px; }
.rank-card .card-head .btn, .goal-card .card-head .btn { flex: 0 0 auto; width: auto; }
.rank-card .card-head .panel-title, .goal-card .card-head .panel-title { flex: 1 1 auto; }
@media (max-width: 400px) {
  .rank-card .card-head, .goal-card .card-head { flex-wrap: wrap; }
  .rank-card .card-head .toolbar-right, .goal-card .card-head .toolbar-right { width: 100%; justify-content: flex-end; }
}
/* v6.5：标题不逐字换行；放不下时整组工具挪到下一行并靠右（v6.4 的 nowrap 把标题挤成竖排，撤回） */
.rank-card .card-head, .goal-card .card-head { flex-wrap: wrap; }
.rank-card .card-head .panel-title, .goal-card .card-head .panel-title { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-card .card-head .toolbar-right, .goal-card .card-head .toolbar-right { margin-left: auto; }
/* ===== v7：宠物乐园 —— 一宠物一卡，经验/心情并排，按钮 44px ===== */
.pet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 12px; padding: 4px 16px 16px; }
.pet-card { display: flex; flex-direction: column; gap: 9px; padding: 13px 14px 12px;
  border: 1px solid #e8edf5; border-radius: 16px; background: #fff;
  box-shadow: 0 1px 2px rgba(18,28,45,.04); transition: border-color .15s, box-shadow .15s; }
.pet-card:hover { border-color: #cfdcf5; box-shadow: 0 12px 24px -20px rgba(18,28,45,.5); }
.pc-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pet-emoji { display: grid; place-items: center; flex: 0 0 auto; width: 48px; height: 48px; font-size: 25px;
  border-radius: 14px; background: #f4f7fc; border: 1px solid #e6ecf6; }
.pet-emoji.e-wood { border-color: #bfe3c8; background: #f2fbf5; }
.pet-emoji.e-fire { border-color: #f6cdc4; background: #fff5f3; }
.pet-emoji.e-earth { border-color: #ecd9b4; background: #fdf8ee; }
.pet-emoji.e-water { border-color: #c3dcf3; background: #f2f8fe; }
.pet-emoji.e-metal { border-color: #d7dee8; background: #f7f9fc; }
.pc-id { flex: 1 1 auto; min-width: 0; }
.pet-name { display: flex; align-items: center; gap: 6px; font-size: 14.5px; font-weight: 750; min-width: 0; }
.pet-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-lv { flex: 0 0 auto; font-size: 10.5px; font-weight: 700; color: var(--primary);
  background: var(--primary-soft); border-radius: 999px; padding: 1px 7px; }
.pet-owner { margin-top: 1px; font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-mood { flex: 0 0 auto; font-size: 19px; line-height: 1; }
.pc-bars { display: flex; flex-direction: column; gap: 5px; }
.pc-bar { display: grid; grid-template-columns: 26px minmax(0, 1fr) 58px; align-items: center; gap: 8px; }
.pc-lab { font-size: 11px; color: var(--ink-3); }
.pc-track { display: block; height: 7px; border-radius: 999px; background: #eef2f8; overflow: hidden; }
.pc-track i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7fa6ff, #2f6bff); }
.pc-bar.mood .pc-track i { background: linear-gradient(90deg, #ffce7a, #f0a63c); }
.pc-val { font-size: 11px; color: var(--ink-3); text-align: right; }
.pc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pc-stat { font-size: 11.5px; color: var(--ink-3); }
.pc-acts { display: flex; gap: 6px; flex: 0 0 auto; }
.pc-acts .btn { min-height: 44px; min-width: 62px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
@media (max-width: 560px) {
  .pet-grid { padding: 2px 12px 14px; grid-template-columns: minmax(0, 1fr); }
  .pc-foot { flex-direction: column; align-items: stretch; gap: 8px; }
  .pc-acts { display: grid; grid-template-columns: repeat(3, 1fr); }
  .pc-acts .btn { width: 100%; }
}
/* v7.1：经验数值列加宽（"120 / 151" 别换成两行）、宠物页工具条在手机上堆叠 */
.pc-bar { grid-template-columns: 26px minmax(0, 1fr) 72px; }
.pc-val { font-size: 11px; white-space: nowrap; }
@media (max-width: 560px) {
  #petToolbar { flex-wrap: wrap; }
  #petToolbar .search, #petToolbar .select, #petToolbar .toolbar-right { flex: 1 1 100%; }
  #petToolbar .toolbar-right .btn { width: 100%; }
}
/* ===== v8：商店 —— 余额置顶成一条钱包栏，一行一件商品，买不起直接写还差几分 ===== */
.shop-page { padding: 0 16px 16px; }
.shop-top { display: flex; align-items: center; gap: 12px; margin: 14px 0 12px; padding: 12px 14px;
  border: 1px solid #e8edf5; border-radius: 16px; background: #fbfcff; }
.w-ava { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  color: #fff; font-size: 17px; font-weight: 750; background: linear-gradient(145deg, #8fb0ff, #3f74ff); }
.w-ava.a2 { background: linear-gradient(145deg, #ffd08a, #f0a63c); }
.w-ava.a3 { background: linear-gradient(145deg, #7fdcb4, #17a06b); }
.w-ava.a4 { background: linear-gradient(145deg, #c9a8ff, #8155e0); }
.w-ava.a5 { background: linear-gradient(145deg, #b9c4d6, #7d8ba1); }
.w-id { flex: 1 1 auto; min-width: 0; }
.w-pick { display: flex; align-items: center; gap: 8px; min-width: 0; }
.w-pick .field-label { flex: 0 0 auto; font-size: 11.5px; color: var(--ink-3); }
.w-pick .select { flex: 0 1 auto; min-width: 0; height: 34px; padding: 0 8px; font-size: 13.5px; font-weight: 700; }
.w-sub { margin: 3px 0 0; font-size: 11px; color: var(--ink-3); }
.w-pts { flex: 0 0 auto; margin: 0; text-align: right; line-height: 1.1; }
.w-pts b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--plus); }
.w-pts i { font-style: normal; font-size: 11px; color: var(--ink-3); }
.shop-tabbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.shop-edit-btn { margin-left: auto; }
#rewardList, #shopList { display: flex; flex-direction: column; gap: 8px; }
.reward-grid, .shop-grid { display: block; }
.shop-card { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid #e8edf5;
  border-radius: 14px; background: #fff; }
.shop-card[data-poor="1"] { background: #fcfcfd; }
.shop-emoji { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; font-size: 21px;
  border-radius: 12px; background: #f4f7fc; }
.shop-main { flex: 1 1 auto; min-width: 0; }
.shop-name { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; }
.shop-have { font-size: 10.5px; font-weight: 600; color: var(--primary); background: var(--primary-soft);
  border-radius: 999px; padding: 1px 6px; }
.shop-note { margin-top: 1px; font-size: 11.5px; color: var(--ink-3); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.shop-buy { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bag-price { font-size: 12px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.bag-price s { color: var(--ink-3); font-weight: 500; margin-right: 2px; }
.bag-price.is-free { color: var(--plus); }
.btn-buy { min-height: 40px; min-width: 72px; padding: 0 13px; border-radius: 11px; border: 0; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap;
  background: linear-gradient(145deg, #4b7fff, #2f6bff 60%, #2453d6); }
.btn-buy:disabled { cursor: not-allowed; color: var(--ink-3); background: #eef2f8; }
@media (max-width: 560px) {
  .shop-page { padding: 0 12px 14px; }
  .shop-card { padding: 10px 11px; gap: 10px; }
  .shop-note { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .shop-buy { gap: 3px; }
  .btn-buy { min-height: 44px; }
  .w-pts b { font-size: 24px; }
}
/* v8.1：宽屏商品排两列，别让一行拉满 1300px */
@media (min-width: 900px) {
  #rewardList, #shopList { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
/* v8.2：买不起的按钮要能看清「还差几分」——别用 3:1 的浅灰 */
.btn-buy:disabled { color: #566174; background: #eef2f8; border: 1px solid #e3e9f3; }
/* ===== v9：工具箱 —— 整块可点的 96px 大卡，图标 54px，右侧箭头 ===== */
.tool-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 12px; padding: 4px 16px 16px; }
.tool-hub-card { display: flex; align-items: center; gap: 14px; min-height: 96px; padding: 16px 18px;
  text-align: left; border: 1px solid #e8edf5; border-radius: 16px; background: #fff; cursor: pointer;
  font: inherit; color: inherit; box-shadow: 0 1px 2px rgba(18,28,45,.04);
  transition: border-color .15s, box-shadow .15s, transform .12s; }
.tool-hub-card:hover { border-color: #cfdcf5; box-shadow: 0 14px 28px -22px rgba(18,28,45,.55); transform: translateY(-1px); }
.tool-hub-card:active { transform: translateY(0); }
.tool-hub-card .tool-icon { flex: 0 0 auto; display: grid; place-items: center; width: 54px; height: 54px;
  font-size: 26px; border-radius: 15px; background: #f4f7fc; border: 1px solid #e6ecf6; }
.tool-hub-name { display: flex; align-items: center; gap: 6px; font-size: 15.5px; font-weight: 750; }
.tool-hub-badge { font-size: 10.5px; font-weight: 600; color: var(--primary); background: var(--primary-soft);
  border-radius: 999px; padding: 1px 7px; }
.tool-hub-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-top: 3px; font-size: 12px; line-height: 1.5; color: var(--ink-3); }
.tool-hub-go { display: none; }
.tool-hub-card::after { content: "进入 →"; flex: 0 0 auto; margin-left: auto; font-size: 12.5px;
  font-weight: 700; color: var(--primary); white-space: nowrap; }
@media (max-width: 560px) {
  .tool-hub-grid { padding: 2px 12px 14px; }
  .tool-hub-card { min-height: 88px; padding: 14px 15px; gap: 12px; }
  .tool-hub-card .tool-icon { width: 48px; height: 48px; font-size: 23px; }
  .tool-hub-card::after { content: "›"; font-size: 20px; }
}
/* v9.1：描述固定两行，卡片等高 */
.tool-hub-card .tool-hub-desc { display: -webkit-box !important; -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important; overflow: hidden !important; }
/* v10：记录页「···」菜单（复用名单页的 .rmore 样式，只补对齐与按钮外观） */
.hchips { gap: 8px; }
.hmore { margin-left: auto; }
.hmore-btn { min-width: 44px; padding: 0 10px; font-size: 15px; letter-spacing: 1px; }
.hmore .rmore-menu { right: 0; left: auto; min-width: 168px; }
/* v12：手机「添加到主屏幕」一次性提示条（只在窄屏出现，12 秒后自己收起） */
.installsheet {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 70; padding: 12px 13px; border-radius: 16px; background: #fff; border: 1px solid #e8edf5;
  box-shadow: 0 18px 40px -18px rgba(18, 28, 45, .45);
  opacity: 0; transform: translateY(14px);
  transition: opacity .2s ease, transform .2s ease;
}
.installsheet.is-in { opacity: 1; transform: none; }
.installsheet .is-head { display: flex; align-items: center; gap: 11px; }
.installsheet .is-icon { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; }
.installsheet .is-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.installsheet .is-txt b { font-size: 14px; font-weight: 750; color: var(--ink); }
.installsheet .is-txt span { font-size: 11.5px; color: var(--ink-3); }
.installsheet .is-acts { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.installsheet .is-acts .btn { min-height: 44px; border-radius: 11px; padding: 0 12px;
  font-size: 13.5px; font-weight: 700; }
.installsheet .is-later { color: var(--ink-2); background: #f4f7fc; border-color: #e6ecf6; }
.installsheet.is-steps .is-acts { grid-template-columns: 1fr; }
.installsheet .is-steps-body { margin-top: 8px; font-size: 12.5px; line-height: 1.7; color: var(--ink-2); }
.installsheet .is-steps-body ol { margin: 0; padding-left: 20px; }
@media (min-width: 821px) { .installsheet { display: none !important; } }
/* v11：桌面端前三立牌铺满整行（原来 max-width 760 居中，两侧留白太大） */
@media (min-width: 900px) {
  .podium { max-width: none; margin: 0; padding: 18px 24px 12px; gap: 16px; }
  .pod { max-width: none; padding: 20px 16px 18px; border-radius: 16px; }
  .pod.p1 { padding-top: 26px; }
  .pod .rava { width: 58px; height: 58px; font-size: 22px; }
  .pod-medal { font-size: 18px; }
  .pod-name { font-size: 15.5px; }
  .pod-sub { font-size: 11.5px; }
  .pod-pts { font-size: 28px; margin-top: 2px; }
  .pod-pts i { font-size: 12px; }
}

/* v13：窄屏（<=400 时 v6.4 会把工具组 flex-end 靠右，左侧空出一条）
   卡片头换行时让「状态胶囊 + 小按钮」占满整行并分列两端；顺带让全班目标卡的
   左右内边距和其它卡一致（原来 16px，标题比「学生积分排行」左移 4px） */
@media (max-width: 560px) {
  .rank-card .card-head .toolbar-right,
  .goal-card .card-head .toolbar-right,
  .rkg-card .card-head .toolbar-right {
    margin-left: 0; width: 100%; flex: 1 1 100%; justify-content: space-between;
  }
  .goal-card { padding-left: 20px; padding-right: 20px; }
}

/* ======================= 成绩页 ======================= */
.g-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 20px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.g-head-ico {
  width: 44px; height: 44px; border-radius: 14px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 21px;
  background: #eef3ff;
}
.g-head-main { flex: 1 1 260px; min-width: 0; }
.g-head-main h2 { font-size: 17px; font-weight: 750; margin: 0; color: var(--ink); }
.g-head-main p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-3); }
.g-head-acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.grade-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.g-stat {
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 14px 18px; box-shadow: var(--shadow); min-width: 0;
}
.g-stat-k { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-stat-v { font-size: 26px; font-weight: 800; color: var(--ink); margin-top: 4px; line-height: 1.2; }
.g-stat-v small { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
.g-stat-note { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

.grade-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.grade-side { display: grid; gap: 12px; }
.grade-side .card { padding: 14px 16px; }
.g-side-title { font-size: 13.5px; font-weight: 750; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.g-side-sub { font-size: 11.5px; color: var(--ink-3); margin: 3px 0 10px; }
.g-side-empty { font-size: 12px; color: var(--ink-3); margin: 6px 0 2px; }
.g-tip p { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; margin: 6px 0 10px; }

.grade-title-wrap { min-width: 0; }
.grade-card .card-head { align-items: flex-start; }
.grade-table th { white-space: nowrap; }
.grade-table td { white-space: nowrap; }
.grade-table tbody tr { cursor: pointer; }
.grade-table tbody tr:hover { background: #f7f9fd; }
.grade-table .g-rank { width: 52px; text-align: center; }
.grade-rk {
  display: inline-grid; place-items: center; width: 24px; height: 24px;
  border-radius: 8px; font-size: 12px; font-weight: 750; color: var(--ink-2); background: #f1f4f9;
}
.g-rk.m1 { background: #fff3cf; color: #9a6b00; }
.g-rk.m2 { background: #eef1f6; color: #5b6577; }
.g-rk.m3 { background: #fde8d5; color: #9c5a25; }
.grade-table .g-who { min-width: 138px; }
.g-who .g-name { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.g-who .g-meta { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
.grade-table .g-sub { text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.grade-table .g-total { text-align: right; font-variant-numeric: tabular-nums; }
.grade-table .g-total b { font-size: 16px; font-weight: 800; }
.grade-table .g-total small { font-size: 10.5px; color: var(--ink-3); font-weight: 600; }
.grade-table .g-delta-cell { text-align: center; width: 66px; }
.g-delta { font-size: 11.5px; font-weight: 700; display: inline-block; padding: 2px 7px; border-radius: 999px; }
.g-delta.up { color: #128a5b; background: #e6f7ef; }
.g-delta.down { color: #c04a45; background: #fdeeee; }
.g-delta.flat { color: var(--ink-3); background: #f3f5f9; }
.g-delta.muted { color: var(--ink-3); background: transparent; }
.grade-table .g-chips { display: none; }
.g-empty { text-align: center; padding: 34px 16px; color: var(--ink-3); font-size: 13px; line-height: 1.9; }
.grade-foot { padding: 10px 18px 14px; font-size: 12px; color: var(--ink-3); border-top: 1px dashed var(--line); margin-top: 4px; }

.g-dist-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.g-dist-k { font-size: 11.5px; color: var(--ink-2); width: 74px; flex: 0 0 auto; }
.g-dist-bar { flex: 1 1 auto; height: 7px; border-radius: 999px; background: #f0f3f8; overflow: hidden; }
.g-dist-bar i { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.g-dist-n { width: 22px; text-align: right; font-size: 11.5px; font-weight: 650; color: var(--ink-2); flex: 0 0 auto; }

.rate-tbl { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.rate-tbl th { text-align: right; color: var(--ink-3); font-weight: 600; padding: 4px 0; border-bottom: 1px solid var(--line); }
.rate-tbl th:first-child, .rate-tbl td:first-child { text-align: left; }
.rate-tbl td { padding: 5px 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); border-bottom: 1px dashed #eef1f6; }
.rate-tbl tr:last-child td { border-bottom: 0; }
.rate-tbl td.low { color: #c04a45; }
.rate-tbl td.pass { color: #128a5b; }
.rate-tbl td.exc { color: var(--primary); }
.rate-tbl tr.rate-total td { font-weight: 750; color: var(--ink); border-top: 1px solid var(--line); }
.rate-note { font-size: 10.5px; color: var(--ink-3); margin: 8px 0 0; line-height: 1.6; }

/* 学生详情里的成绩块 */
.detail-grades { margin-bottom: 14px; }
.dg-card { background: #f7f9fd; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.dg-head { font-size: 13px; font-weight: 750; color: var(--ink); margin-bottom: 8px; }
.dg-exams { display: flex; gap: 10px; flex-wrap: wrap; }
.dg-exam {
  flex: 1 1 150px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px;
}
.dg-exam.is-on { border-color: #c9d8ff; box-shadow: 0 0 0 3px #eef3ff; }
.dg-en { font-size: 12px; color: var(--ink-3); }
.dg-et { font-size: 18px; font-weight: 800; color: var(--ink); }
.dg-et small { font-size: 10.5px; color: var(--ink-3); font-weight: 600; }
.dg-er { font-size: 11px; color: var(--ink-3); }
.dg-subs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dg-note { font-size: 11px; color: var(--ink-3); margin-top: 8px; }
.dg-empty { font-size: 12px; color: var(--ink-3); margin: 4px 0 2px; }

/* 成绩导入弹窗 */
.gi-top { display: grid; grid-template-columns: minmax(0, 210px) minmax(0, 1fr); gap: 10px 20px; align-items: start; margin-bottom: 12px; }
.gi-top .field { margin: 0; display: flex; flex-direction: column; gap: 7px; }
.gi-top .field > .select { min-width: 0; width: 100%; }
.gi-file { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; align-self: flex-start; }
.gi-name { font-size: 12px; color: var(--ink-3); line-height: 1.5; min-height: 18px; }
.gi-foot-note { margin-right: auto; font-size: 12px; }
@media (max-width: 760px) { .gi-top { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  #modalGradeImport .modal-foot { flex-wrap: wrap; }
  .gi-foot-note { flex: 1 1 100%; margin: 0 0 8px; }
}
.gi-note { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; margin: 4px 0 10px; }
.gi-note .g-warn { color: #c04a45; }
.g-map { display: flex; gap: 10px; font-size: 12px; padding: 4px 0; color: var(--ink-2); }
.g-map-k { flex: 0 0 44px; color: var(--ink-3); }
.g-map-v { flex: 1 1 auto; }
.g-preview { margin-top: 10px; }
.g-preview th, .g-preview td { text-align: right; }
.g-preview th:nth-child(2), .g-preview td:nth-child(2) { text-align: left; }
.g-preview td:first-child { text-align: left; }

@media (max-width: 1180px) {
  .grade-layout { grid-template-columns: 1fr; }
  .grade-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-tip { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .grade-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-head { padding: 14px; }
  .g-head-acts { margin-left: 0; width: 100%; }
  .g-head-acts .btn { flex: 1 1 0; }
}
@media (max-width: 640px) {
  .grade-stats { gap: 10px; }
  .g-stat { padding: 12px 14px; border-radius: 16px; }
  .g-stat-v { font-size: 22px; }
  .grade-side { grid-template-columns: 1fr; }
  .grade-card .card-head { flex-wrap: wrap; gap: 10px; }
  .grade-card .seg { width: 100%; }
  .grade-card .seg .seg-item { flex: 1 1 0; }

  .grade-table, .grade-table tbody { display: block; width: 100%; }
  .grade-table thead { display: none; }
  .grade-table tbody tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px;
    border: 1px solid var(--line); border-radius: 14px;
    padding: 10px 12px; margin: 0 0 10px; position: relative;
  }
  .grade-table tbody tr:hover { background: #f7f9fd; }
  .grade-table td { display: block; border: 0; padding: 0; width: auto; white-space: normal; }
  .grade-table .g-rank { width: 22px; }
  .grade-rk { width: 20px; height: 20px; border-radius: 6px; font-size: 11px; }
  .grade-table .g-who { flex: 1 1 auto; min-width: 0; }
  .grade-table .g-total { margin-left: auto; text-align: right; }
  .grade-table .g-total b { font-size: 17px; }
  .grade-table .g-delta-cell { flex: 0 0 auto; width: auto; margin-left: 2px; }
  .grade-table .g-sub { display: none; }
  .grade-table .g-chips { order: 9; display: flex; flex-wrap: wrap; gap: 5px; width: 100%; margin-top: 7px; }
  .g-chip {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 650; color: var(--ink-2);
    background: #f8fafd; border-radius: 9px; padding: 4px 9px;
    font-variant-numeric: tabular-nums;
  }
  .g-chip i { font-style: normal; font-size: 10.5px; color: var(--ink-3); font-weight: 600; }
  .grade-table .g-empty { width: 100%; }
  .detail-grades { margin-top: 2px; }
  .dg-exam { flex: 1 1 100%; }
}

/* 成绩表表头对齐（与单元格一致） */
.grade-table th.g-sub, .grade-table th.g-delta-cell { text-align: center; }
.grade-table th.g-total { text-align: right; }
.g-preview th:first-child, .g-preview td:first-child { text-align: left; }
.g-preview th:not(:first-child), .g-preview td:not(:first-child) { text-align: right; }

/* 手机上成绩行改成三列网格，保证总分一定露出来 */
@media (max-width: 640px) {
  .grade-table { min-width: 0; }
  .grade-table tbody tr {
    display: grid; grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 4px 8px; align-items: center;
  }
  .grade-table .g-rank { grid-column: 1; grid-row: 1; }
  .grade-table .g-who { grid-column: 2; grid-row: 1; }
  .grade-table .g-total { grid-column: 3; grid-row: 1; margin: 0; }
  .grade-table .g-delta-cell { grid-column: 3; grid-row: 2; justify-self: end; }
  .grade-table .g-chips { grid-column: 1 / 4; grid-row: 3; margin-top: 4px; }
}



/* 详情里的成绩：每科一行 */
.dg-rows { display: flex; flex-direction: column; border-top: 1px solid var(--line); margin-top: 8px; }
.dg-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 2px; border-bottom: 1px solid #eef2f8; }
.dg-row:last-child { border-bottom: 0; }
.dg-rk { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.dg-rv { font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; }
.dg-rv small { font-size: 10.5px; font-weight: 600; color: var(--ink-3); margin-left: 2px; }
.dg-rv em { font-style: normal; font-weight: 600; color: var(--ink-3); }
@media (max-width: 760px) { .g-head-acts { flex-wrap: wrap; } .g-head-acts .btn { flex: 1 1 calc(50% - 6px); } }

/* v15：「兑换奖品 / 买宠物用品」花掉的积分改用紫色 —— 花出去 ≠ 被扣分，别让学生以为是惩罚 */
.hpill.spend { color: #6b4fd8; background: #f0ebff; }
.detail-row .a.spend { color: #6b4fd8; }
.parent-txn .pt-amt.is-spend { color: #6b4fd8; }

/* v16：全班目标「＋ 补进度」——扣学生积分补进目标，扣的这一笔不动段位分（见 isLvNeutral） */
.gtarget .gchip {
  display: inline-flex; align-items: center; margin-left: 8px; padding: 2px 7px;
  border-radius: 999px; background: #eef3ff; color: #2f6bff;
  font-size: 11.5px; font-weight: 700; vertical-align: 3px; letter-spacing: 0;
}
.btn-boost { background: #eef3ff; color: #2f6bff; border: 1px solid #cfe0ff; font-weight: 700; }
.btn-boost:hover { background: #e3edff; }
.btn-boost:active { transform: translateY(1px); }

/* 补进度弹窗 */
.gb-hint { margin: 0 0 10px; line-height: 1.7; }
.gb-hint b { color: var(--ink-2); }
.gb-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 7px; }
.gb-tools { display: inline-flex; align-items: center; gap: 10px; }
.gb-tools .muted { margin: 0; font-size: 12px; }
.gb-picks {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  max-height: 168px; overflow: auto; padding: 2px; border-radius: 10px;
}
.gb-pick {
  position: relative; display: flex; align-items: center; gap: 6px; min-width: 0;
  padding: 5px 22px 5px 5px; border: 1px solid #e6ecf5; border-radius: 9px;
  background: #fff; cursor: pointer; font-family: inherit; text-align: left;
}
.gb-pick .gb-av {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 750; color: #fff;
  background: linear-gradient(145deg, #8fb0ff, #3f74ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4);
}
.gb-pick .gb-av.a2 { background: linear-gradient(145deg, #ffd08a, #f0a63c); }
.gb-pick .gb-av.a3 { background: linear-gradient(145deg, #7fdcb4, #17a06b); }
.gb-pick .gb-av.a4 { background: linear-gradient(145deg, #c9a8ff, #8155e0); }
.gb-pick .gb-av.a5 { background: linear-gradient(145deg, #b9c4d6, #7d8ba1); }
.gb-pick .gpk-name {
  flex: 1 1 auto; min-width: 0; font-size: 12px; font-weight: 600; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gb-pick .gpk-ck {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 13px; height: 13px; border-radius: 50%; background: #e6ecf5; color: #fff;
  font-size: 9px; line-height: 1; display: grid; place-items: center;
}
.gb-pick.is-on { border-color: var(--primary); background: #f4f8ff; }
.gb-pick.is-on .gpk-ck { background: var(--primary); }
.gb-pickhint { margin: 6px 0 10px; font-size: 11.5px; }
.gb-mode { margin: 0 0 10px; }
.gb-mode .field-label { display: block; margin-bottom: 6px; }
.gb-amount { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; flex-wrap: wrap; }
.gb-step {
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid #e6ecf5; background: #fff;
  cursor: pointer; color: var(--ink-2); font-family: inherit; font-size: 15px; line-height: 1;
}
.gb-step:hover { border-color: #cfe0ff; color: var(--primary); }
.gb-num {
  width: 64px; height: 30px; padding: 0 6px; border-radius: 9px; border: 1px solid #e6ecf5;
  font-family: inherit; font-size: 13px; font-weight: 650; text-align: center; color: var(--ink);
}
.gb-unit { font-size: 12.5px; color: var(--ink-3); }
.gb-sum { margin-left: auto; font-size: 12px; }
.gb-sum b { font-weight: 750; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.gb-preview { padding: 9px 11px; border-radius: 10px; background: #f6f9ff; border: 1px solid #e4edfb; }
.gb-prev-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--ink-2); }
.gb-prev-head b { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.gb-prev-bar { height: 6px; margin: 7px 0 5px; border-radius: 99px; background: #e3eaf7; overflow: hidden; }
.gb-prev-bar span { display: block; width: 0; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #9dc0ff, #2f6bff); transition: width .2s; }
.gb-preview .muted { margin: 0; font-size: 11.5px; }

@media (max-width: 560px) {
  .gb-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 150px; }
}

/* ============================================================
   v17 · 自习课音量表改成竖的（2026-10-26 老师：做成垂直的、做大一点，学生看着反馈感更强）
   旧的 .sound-bar/.quiet-bar 留着不动（早读那边还在用），自习课这边换成 .qm-*
   ============================================================ */
.qm-wrap { display: flex; align-items: stretch; gap: 20px; }
/* 大屏别把「一条竖表 + 一行字」摊在一千多像素的卡里，收成一个居中的窄组 */
@media (min-width: 821px) {
  .qm-wrap { max-width: 680px; margin: 0 auto; }
  .qm-side { justify-content: center; }
}
.qm-side { display: flex; flex-direction: column; justify-content: center; min-width: 0; flex: 1 1 auto; }

.qm-meter { position: relative; flex: 0 0 auto; padding-right: 26px; }
.qm-track {
  position: relative;
  width: 62px;
  height: 224px;
  border-radius: 16px;
  background: #e8edf5;
  box-shadow: inset 0 2px 7px rgba(20, 32, 54, .12), inset 0 -1px 0 rgba(255, 255, 255, .8);
  overflow: hidden;
}
.qm-fill {
  position: absolute;
  left: 0; right: 0; bottom: 0; top: 0;
  /* 渐变固定铺满整条轨道，用 clip-path 从底部往上「揭开」，这样小音量时不会一上来就是红的 */
  clip-path: inset(100% 0 0 0);
  background: linear-gradient(180deg, #e2504a 0%, #ef8f2b 22%, #e3c93f 40%, #2bb37a 66%, #5ec99b 100%);
  transition: clip-path .1s linear;
}
.qm-fill.is-over { background: linear-gradient(180deg, #d93a34 0%, #e2504a 45%, #f0932b 100%); }

.qm-thr {
  position: absolute;
  left: 0;
  right: 26px;
  height: 0;
  border-top: 2px dashed rgba(217, 69, 63, .9);
  pointer-events: none;
  transition: bottom .2s linear;
}
.qm-thr-tag {
  position: absolute;
  left: 60px;
  top: -8px;
  padding: 0 5px;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 800;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
  color: #d9453f;
  background: #fff;
  border: 1px solid rgba(217, 69, 63, .38);
  border-radius: 6px;
}
.quiet-hero.is-over .qm-thr-tag { background: #fff2f1; }
/* 超标时填充是红的，红色虚线会看不见——换成白色虚线，仍站在同一格刻度上 */
.quiet-hero.is-over .qm-thr { border-top-color: rgba(255, 255, 255, .92); }

@media (max-width: 560px) {
  .qm-wrap { gap: 14px; }
  .qm-track { width: 54px; height: 192px; border-radius: 15px; }
  .qm-thr-tag { left: 56px; }
  .quiet-now { align-items: baseline; }
  .quiet-db { font-size: 40px; }
  .quiet-verdict { font-size: 14.5px; margin: 6px 0 8px; }
  .quiet-meta { font-size: 12px; gap: 10px 12px; margin-top: 8px; }
}

/* ============================================================
   v18 · 早读音量表也改成竖的（2026-10-26 老师：想改的是早读的，自习的就这样）
   复用 v17 的 .qm-*；多两条基准线（88 太吵 / 6 偏小）和一条峰值线
   ============================================================ */
.meter-single .qm-wrap { align-items: center; }
/* 峰值：一条细横线（别做粗，粗了像分隔条） */
.meter-single .qm-peak {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  border-radius: 2px;
  background: rgba(27, 36, 48, .42);
  opacity: 0;
  transition: bottom .2s linear, opacity .2s;
}
/* 太吵时填充是红的，88 那条红线会看不见——换白 */
.meter-single.is-hot #hiMark { border-top-color: rgba(255, 255, 255, .92); }
.meter-single.is-hot #hiMark .qm-thr-tag { background: #fff2f1; }

@media (max-width: 560px) {
  .meter-single .side-db > span:first-child { font-size: 38px; }
  .meter-single .qm-wrap { gap: 16px; }
}
/* ============================================================
   v19 · 早读：鼓励语横幅 + 实时质量分（2026-10-26 老师：音量到一定值显示自定义鼓励语，并把评分显示在界面上）
   ============================================================ */
.cheer-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eef6ff, #e8f1ff 60%, #f3f8ff);
  border: 1px solid rgba(47, 107, 255, .16);
  color: #1c4fd6;
  text-align: center;
  transition: background .2s, border-color .2s, color .2s;
}
.cheer-ico { font-size: 20px; line-height: 1; flex: 0 0 auto; }
.cheer-text {
  text-wrap: balance;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: .3px;
  line-height: 1.35;
}
.cheer-bar.is-hot {
  background: linear-gradient(135deg, #fff3e9, #ffeef0);
  border-color: rgba(226, 80, 74, .28);
  color: #b3352f;
}

/* 实时质量分 */
.live-score {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fbfcfe;
  border: 1px solid #e9eef6;
}
.live-score.is-idle { background: #f7f9fc; }
.ls-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ls-name { font-size: 13px; font-weight: 700; color: var(--ink-3); }
.ls-val { display: flex; align-items: baseline; gap: 8px; }
.ls-val b { font-size: 30px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; color: var(--ink-1); }
.ls-val i { font-style: normal; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.ls-bar { height: 10px; border-radius: 999px; background: #eef1f6; overflow: hidden; margin: 10px 0 9px; }
.ls-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: #8b97a8; transition: width .25s linear, background .2s; }
.ls-fill.q-great { background: linear-gradient(90deg, #2bb37a, #15a06a); }
.ls-fill.q-good { background: linear-gradient(90deg, #4cc38a, #2bb37a); }
.ls-fill.q-mid { background: linear-gradient(90deg, #f0a800, #e39400); }
.ls-fill.q-poor { background: linear-gradient(90deg, #e2504a, #cf3f39); }
.ls-parts { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.ls-parts b { color: var(--ink-2); font-weight: 800; font-variant-numeric: tabular-nums; }
.ls-parts i { font-style: normal; opacity: .65; }

/* 鼓励语设置：门槛 + 文案 + 删除 */
.cheer-cfg { margin: 4px 0 16px; }
.cheer-cfg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.cheer-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.cheer-row { display: flex; align-items: center; gap: 8px; }
.cheer-at { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; font-size: 12px; color: var(--ink-3); font-weight: 700; }
.cheer-at input {
  width: 58px;
  padding: 7px 8px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  border: 1px solid #dde4ef;
  border-radius: 9px;
  background: #fff;
  color: var(--ink-1);
}
.cheer-txt {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 11px;
  font-size: 13px;
  border: 1px solid #dde4ef;
  border-radius: 10px;
  background: #fff;
  color: var(--ink-1);
}
.cheer-del { flex: 0 0 auto; color: #c0392f; }

@media (max-width: 560px) {
  .cheer-text { font-size: 18px; }
  .cheer-bar { padding: 12px 13px; }
  .ls-val b { font-size: 26px; }
  .cheer-at span { display: none; }
  .cheer-at input { width: 50px; }
}
/* 鼓励语收到小按钮里：弹窗内的行距与滚动 */
#modalCheer .modal-body { overflow-y: auto; }
#modalCheer .cheer-rows { margin-top: 0; }
#modalCheer .cheer-row { gap: 7px; }
/* ================= v21：积分页搜索框直接选人（批量多选） =================
   老师原话：「选多个人的时候在搜索框一个一个搜效率太低了，我想在搜索框输入学号
   或者名字的时候可以直接选中这个学生，并且可以一次性输入多个学生」 */
.sel-wrap { position: relative; flex: 1 1 240px; min-width: 0; display: flex; }
.sel-wrap .search { flex: 1 1 auto; width: 100%; max-width: none; }
.sel-sug {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60;
  padding: 6px;
  background: #fff; border: 1px solid #e3e9f4; border-radius: 14px;
  box-shadow: 0 22px 44px -22px rgba(18, 28, 45, .38), 0 2px 6px rgba(18, 28, 45, .06);
  max-height: 336px; overflow-y: auto;
}
.sel-sug[hidden] { display: none; }
.sel-sug-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 9px; border: 0; border-radius: 10px;
  background: transparent; text-align: left; cursor: pointer;
  font-family: inherit; font-size: 14px; color: var(--ink-1);
}
.sel-sug-item.is-hi { background: #eef4ff; }
.sel-sug-item.is-on { opacity: .72; }
.sel-sug-item .sug-ava { width: 30px; height: 30px; font-size: 13px; }
.sug-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.sug-main b { font-weight: 750; font-size: 14.5px; white-space: nowrap; }
.sug-main i {
  font-style: normal; font-size: 11.5px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sug-pts { flex: 0 0 auto; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ink-1); }
.sug-pts.is-neg { color: var(--minus); }
.sug-mark { flex: 0 0 auto; width: 30px; text-align: right; font-size: 11.5px; font-weight: 700; color: #15a06a; }
.sel-sug-all {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px;
  border: 0; border-top: 1px dashed #e8edf5; border-radius: 0 0 10px 10px;
  background: transparent; text-align: left; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--primary);
}
.sel-sug-all:hover { background: #f4f8ff; }

/* 已选学生的小芯片条 */
.sel-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -4px 0 12px; }
.sel-chips[hidden] { display: none; }
.sel-chip-lab { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.sel-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 9px 5px 10px; border-radius: 999px;
  border: 1px solid #cfdcf9; background: #f2f7ff; color: #23508f;
  font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.sel-chip:hover { background: #e8f0ff; border-color: #b6cdf5; }
.sel-chip i { font-style: normal; font-size: 13px; color: #7c93b5; }
.sel-chip:hover i { color: var(--minus); }
.sel-chip-more { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.sel-chip-clear {
  margin-left: 2px; padding: 5px 10px; border-radius: 999px;
  border: 1px dashed #dbe3ef; background: transparent; color: var(--ink-3);
  font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.sel-chip-clear:hover { border-color: #e9a8a3; color: var(--minus); }

@media (max-width: 780px) {
  .sel-wrap { flex: 1 1 100%; }
  .sel-sug { max-height: 300px; }
  .sel-chips { margin-top: -6px; }
}

/* v21 批量选人：补一条同名多的用例（「雨」→ 6 行候选 + 全部匹配） */
body.has-sticky-acts .toast-stack { bottom: 86px; }

/* 下面放不下时候选框翻到输入框上方 */
.sel-sug.is-up { top: auto; bottom: calc(100% + 6px); }

/* 「选中全部匹配」永远贴在候选框底部，列表再长也点得到 */
.sel-sug { padding: 6px 6px 0; }
.sel-sug-all {
  position: sticky; bottom: 0;
  background: #fff; border-radius: 0 0 12px 12px;
  margin-top: 0;
}
@media (max-width: 780px) {
  .sel-sug { max-height: 340px; padding: 6px 6px 0; }
  .sel-sug-item { padding: 7px 8px; }
}

/* ============================================================
   工具箱 · 排座位（v22）
   一体化/电脑：二维座位图，可拖可点；手机：按排分组的名单块
   ============================================================ */
.seat-card { overflow: visible; }
.seat-card.tool-card { padding: 0; }

/* ---------- 工具条 ---------- */
.seat-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfcfe, #fff);
}
.seat-seg { padding: 3px; border-radius: 11px; }
.seat-seg .seg-item { padding: 8px 11px; font-size: 12.5px; border-radius: 8px; white-space: nowrap; }
.seat-auto { height: 40px; padding: 0 18px; }
.seat-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.seat-stats .pill { font-size: 12px; padding: 4px 10px; }
.seat-right { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.seat-right .btn { height: 36px; }
.seat-dd { position: relative; }

.seat-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 80;
  min-width: 220px; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow);
}
.seat-menu[hidden] { display: none; }
.seat-menu-right { right: 0; }
.seat-mi {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 10px; border: 0; background: none; border-radius: 8px;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  text-align: left; cursor: pointer;
}
.seat-mi:hover { background: #f5f7fb; }
.seat-mi.is-on { background: var(--primary-soft); color: var(--primary); }
.seat-mi.is-danger { color: var(--minus); }
.seat-mi.is-tip { color: var(--ink-3); font-weight: 600; font-size: 12.5px; cursor: default; }
.seat-mi.is-tip:hover { background: none; }
.seat-mi-k { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.seat-mi-sep { height: 1px; background: var(--line); margin: 5px 6px; }
.seat-plan-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-mi-x {
  width: 18px; height: 18px; margin-left: 2px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 5px; color: var(--ink-3); font-size: 11px; font-weight: 700;
}
.seat-mi-x:hover { background: var(--minus-soft); color: var(--minus); }

/* ---------- 舞台 ---------- */
.seat-stage { padding: 16px 22px 12px; background: linear-gradient(180deg, #fbfcfe 0%, #fff 55%); }
.seat-podium {
  width: min(460px, 60%); margin: 2px auto 14px;
  padding: 8px 0; text-align: center;
  border: 1px dashed #cfdcf5; border-radius: 9px; background: #f7f9fd;
  color: #7d8ba1; font-size: 12.5px; font-weight: 650; letter-spacing: .34em;
}
.seat-ghead { display: flex; gap: 22px; align-items: center; margin-bottom: 5px; }
.seat-ghead-inner { flex: 1; display: flex; gap: 22px; }
.seat-glabel {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 3px 0; margin: -3px 0;
  font-size: 11.5px; font-weight: 650; color: var(--ink-3); letter-spacing: .08em;
  border-radius: 7px; cursor: grab;
  touch-action: none; -webkit-user-select: none; user-select: none;
  transition: background .12s ease, color .12s ease, opacity .12s ease;
}
.seat-glabel:hover { background: #eef3fb; color: var(--ink-2); }
.seat-grip {
  flex: 0 0 auto; width: 8px; height: 12px; border-radius: 2px;
  background-image: radial-gradient(circle, #a3aec0 .95px, transparent 1.15px);
  background-size: 4px 4px; background-position: 0 0;
}
.seat-glabel:hover .seat-grip { background-image: radial-gradient(circle, #7f8da3 .95px, transparent 1.15px); }
.seat-glabel.is-gdrag-src { opacity: .35; }
.seat-group.is-gdrag-src { opacity: .5; }
.seat-glabel.is-gdrop {
  background: #e9f0ff; color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(47, 107, 255, .45);
}
.seat-glabel.is-gdrop .seat-grip { background-image: radial-gradient(circle, rgba(47, 107, 255, .75) .95px, transparent 1.15px); }
.seat-group.is-gdrop {
  outline: 2px dashed rgba(47, 107, 255, .5); outline-offset: 4px;
  border-radius: 16px; background: rgba(47, 107, 255, .045);
}
body.seat-gdragging { cursor: grabbing; }
body.seat-gdragging * { -webkit-user-select: none; user-select: none; }
.seat-rowlabel { flex: 0 0 44px; width: 44px; text-align: center; font-size: 11.5px; font-weight: 650; color: var(--ink-3); }
.seat-row { display: flex; gap: 22px; align-items: stretch; margin-bottom: 8px; }
.seat-row:last-child { margin-bottom: 0; }
.seat-groups { flex: 1; display: flex; gap: 22px; }
.seat-group { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }

.seat {
  position: relative; display: flex; align-items: center; gap: 8px;
  height: 66px; padding: 8px 9px; min-width: 0;
  border: 1px solid #e6ebf4; border-radius: 14px; background: #fff;
  box-shadow: 0 1px 2px rgba(18, 28, 45, .04);
  font-family: inherit; color: inherit; text-align: left; cursor: pointer;
  touch-action: none; -webkit-user-select: none; user-select: none;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.seat:hover { transform: translateY(-1px); border-color: #cfdcf5; box-shadow: 0 14px 28px -22px rgba(18, 28, 45, .55); }
.seat-ava {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13.5px; font-weight: 700;
  background: linear-gradient(145deg, #8fb4ff, #3a6ff0);
}
.seat-ava.a2 { background: linear-gradient(145deg, #ffd08a, #f0a63c); }
.seat-ava.a3 { background: linear-gradient(145deg, #7fdcb4, #17a06b); }
.seat-ava.a4 { background: linear-gradient(145deg, #c9a8ff, #8155e0); }
.seat-ava.a5 { background: linear-gradient(145deg, #b9c4d6, #7d8ba1); }
.seat-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.seat-name { font-size: 14.5px; font-weight: 750; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-no { font-size: 10.5px; font-weight: 600; color: var(--ink-3); }
.seat.is-empty { border-style: dashed; border-color: #e9eef7; background: #fbfcfe; }
.seat.is-empty:hover { transform: none; border-color: #d7e2f6; box-shadow: none; }
.seat.is-empty .seat-name { color: var(--ink-3); font-weight: 650; }
.seat.is-lock { border-color: #f0dfb6; background: #fffdf7; }
.seat-lock {
  position: absolute; top: -7px; right: 8px;
  padding: 1px 6px; border-radius: 999px;
  background: #fff6e5; border: 1px solid #f0dfb6;
  color: #b8892a; font-size: 10px; font-weight: 700; letter-spacing: .02em;
}
.seat.is-sel { border-color: var(--primary); background: #fbfdff; box-shadow: 0 0 0 3px rgba(47, 107, 255, .14); }
.seat.is-drop { border-color: var(--primary); border-width: 2px; background: #fbfdff; box-shadow: 0 0 0 4px rgba(47, 107, 255, .12); }
.seat-stage.is-dragmode .seat:not(.is-dragging) { border-style: dashed; border-color: #b9cbf0; }
.seat.is-dragging { opacity: .34; border-style: dashed; filter: grayscale(.45); }

.seat-ghost {
  position: fixed; z-index: 9999; pointer-events: none;
  width: 150px; padding: 9px 10px;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid #cfdcf5; border-radius: 14px; background: #fff;
  box-shadow: 0 20px 40px -18px rgba(15, 25, 45, .5);
  transform: translate(-50%, -50%) rotate(-1.5deg);
}
.seat-ghost .seat-name { font-size: 14px; }
body.seat-dragging { cursor: grabbing; }
body.seat-dragging * { -webkit-user-select: none; user-select: none; }
.drag-tip {
  position: fixed; z-index: 10000; transform: translateX(-50%);
  padding: 7px 12px; border-radius: 9px;
  background: #1b2430; color: #fff; font-size: 12px; font-weight: 650;
  white-space: nowrap; pointer-events: none;
  box-shadow: 0 12px 24px -12px rgba(0, 0, 0, .5);
}

/* ---------- 手机：名单块 ---------- */
.seat-list { display: none; padding: 2px 12px 10px; }
.seat-list-row { padding: 8px 0 10px; border-bottom: 1px dashed #eef2f8; }
.seat-list-row:last-child { border-bottom: 0; }
.seat-list-title { margin: 0 0 7px; font-size: 11.5px; font-weight: 650; color: var(--ink-3); letter-spacing: .1em; }
.seat-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 7px; }
.seat-chip {
  position: relative; display: flex; align-items: center; gap: 7px;
  min-height: 46px; padding: 6px 8px; min-width: 0;
  border: 1px solid #e6ebf4; border-radius: 12px; background: #fff;
  font-family: inherit; color: inherit; text-align: left; cursor: pointer;
  touch-action: pan-y;
}
.seat-chip .seat-ava { width: 26px; height: 26px; font-size: 11.5px; }
.seat-chip .seat-name { font-size: 13px; font-weight: 700; }
.seat-chip .seat-no { font-size: 10.5px; }
.seat-chip .seat-lock { top: -6px; right: 6px; font-size: 9.5px; padding: 0 5px; }
.seat-chip.is-empty { border-style: dashed; border-color: #e9eef7; background: #fbfcfe; }
.seat-chip.is-empty .seat-name { color: var(--ink-3); font-weight: 600; }
.seat-chip.is-lock { border-color: #f0dfb6; background: #fffdf7; }
.seat-chip.is-sel { border-color: var(--primary); background: #fbfdff; box-shadow: 0 0 0 3px rgba(47, 107, 255, .14); }

/* ---------- 底部选中条 ---------- */
.seat-selbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 18px; border-top: 1px solid var(--line); background: #f7faff;
}
.seat-selbar[hidden] { display: none; }
.seat-sel-text { font-size: 13px; color: var(--ink-2); }
.seat-sel-text b { font-size: 14.5px; font-weight: 750; color: var(--ink); margin: 0 2px; }
.seat-sel-text i { font-style: normal; margin-left: 4px; font-size: 12.5px; color: var(--ink-3); }
.seat-sel-acts { margin-left: auto; display: flex; gap: 6px; }
#btnSeatLock.is-on { background: var(--primary-soft); border-color: #c3d4ff; color: var(--primary); }

/* ---------- 页脚 ---------- */
.seat-foot {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 18px 11px; border-top: 1px solid var(--line);
  background: #fbfcfe; font-size: 11.5px; color: var(--ink-3); font-weight: 600;
}
.seat-legend { display: flex; align-items: center; }
.seat-legend i {
  display: inline-block; width: 15px; height: 11px; margin-right: 5px;
  border: 1px solid #d3dae7; border-radius: 4px; background: #fff;
}
.seat-legend i:not(:first-child) { margin-left: 12px; }
.seat-legend i.lg-off { border-style: dashed; background: #fbfcfe; }
.seat-legend i.lg-fix { background: #fff6e5; border-color: #f0dfb6; }
.seat-foot-note { margin-left: auto; }

/* ---------- 设置弹窗 ---------- */
.seat-set-row { display: flex; gap: 10px; }
.seat-set-row .field { flex: 1 1 0; min-width: 0; }
.seat-set-note { margin: 12px 0 0; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }

@media (max-width: 720px) {
  .seat-bar { padding: 10px 12px; gap: 9px; }
  .seat-seg { width: 100%; }
  .seat-seg .seg-item { flex: 1 0 auto; padding: 8px 6px; font-size: 12px; }
  .seat-auto { width: 100%; }
  .seat-stats { order: 3; }
  .seat-right { width: 100%; margin-left: 0; }
  .seat-right > .btn, .seat-right > .seat-dd { flex: 1; }
  .seat-right .seat-dd > .btn { width: 100%; }
  .seat-right .btn { height: 40px; }
  .seat-podium, .seat-ghead, #seatMapBody { display: none; }
  .seat-list { display: block; }
  .seat-selbar { padding: 10px 12px; }
  .seat-sel-text { font-size: 12.5px; }
  .seat-sel-acts { width: 100%; margin-left: 0; }
  .seat-sel-acts .btn { flex: 1; }
  .seat-foot { padding: 9px 12px 10px; gap: 10px; }
  .seat-foot-note { display: none; }
}

@media print {
  .topbar, .tabbar, .seat-bar, .seat-selbar, .seat-foot,
  .seat-card .pet-head-actions, .seat-card .card-note { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .seat-card, .seat-card.tool-card { border: 0; box-shadow: none; }
  .seat-stage { padding: 0; background: #fff; }
  .seat-list { display: none !important; }
  .seat-podium, .seat-ghead, #seatMapBody { display: block !important; }
  .seat-ghead { display: flex !important; }
  .seat-row { break-inside: avoid; }
  .seat { box-shadow: none; }
  .seat-ava { display: none; }
  .seat { padding: 6px 8px; }
}
