/* ============================================================
 * 数Σ学 · 全局样式（桌面端优先）
 * ============================================================ */
:root {
  --primary: #4c6ef5;
  --primary-600: #3b5bdb;
  --primary-050: #eef1fe;
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e6e9f2;
  --text: #232946;
  --muted: #7a819e;
  --green: #0ca678;
  --green-bg: #e6f7f1;
  --amber: #e8890c;
  --amber-bg: #fff3e0;
  --red: #e03131;
  --red-bg: #fdecec;
  --blue: #1c7ed6;
  --blue-bg: #e7f1fb;
  --gray-bg: #eef0f6;
  --shadow: 0 1px 3px rgba(35, 41, 70, 0.06);
  --shadow-lg: 0 16px 48px rgba(35, 41, 70, 0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.icon { flex: none; vertical-align: -3px; }
.muted { color: var(--muted); font-size: 13px; }
.error-text { color: var(--red); }

/* ================= 布局 ================= */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px;
  flex: none;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.brand-logo {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), #7048e8);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.brand-logo.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 30px; }
/* logo 图片（像素化 SVG）铺满圆角容器 */
.brand-logo, .welcome-logo { overflow: hidden; }
.brand-logo img, .welcome-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-name { font-size: 17px; font-weight: 700; display: flex; flex-direction: column; line-height: 1.25; }
.brand-name em { font-style: normal; font-size: 11px; font-weight: 500; color: var(--muted); }

.nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #4a5068;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--primary-050); color: var(--primary-600); }
.nav-item.active { background: var(--primary-050); color: var(--primary-600); font-weight: 600; }

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: #4a5068;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.content { padding: 24px 28px 64px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ================= 用户区 ================= */
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  user-select: none;
}
.user-chip:hover { background: #f4f6fb; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7048e8);
  color: #fff; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.user-meta { line-height: 1.25; }
.user-name { font-weight: 600; font-size: 13px; }
.user-sub { font-size: 11px; color: var(--muted); }

.user-menu {
  position: absolute;
  top: 52px; right: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 148px;
  z-index: 60;
}
.user-menu button {
  display: block; width: 100%;
  border: none; background: none;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.user-menu button:hover { background: #f4f6fb; }
.user-menu button.danger { color: var(--red); }

/* ================= 消息通知 ================= */
.notif-wrap { position: relative; }
.notif-btn {
  position: relative;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none;
  border-radius: 10px; color: var(--text);
  cursor: pointer;
}
.notif-btn:hover { background: #f4f6fb; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px;
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--card);
}
.notif-panel {
  position: absolute; top: 50px; right: 0;
  width: 320px; max-width: calc(100vw - 32px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  overflow: hidden;
}
.notif-head {
  padding: 12px 14px;
  font-weight: 600; font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.notif-body { max-height: 380px; overflow-y: auto; padding: 6px; }
.notif-group { padding: 4px 0; }
.notif-group-title {
  padding: 6px 8px 4px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.notif-item {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
}
.notif-item:hover { background: #f4f6fb; }
.notif-item-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.notif-item-summary {
  margin-top: 2px;
  font-size: 12px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.notif-item-time {
  margin-top: 2px;
  font-size: 11px; color: var(--muted);
}
.notif-empty {
  padding: 22px 14px;
  text-align: center;
  font-size: 13px; color: var(--muted);
}

/* ================= 登录页 ================= */
.login-page {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(160deg, #eef2ff 0%, #f4f6fb 45%, #e9f7f4 100%);
  padding: 24px;
}
.login-card {
  width: 400px; max-width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 12px 40px rgba(35, 41, 70, 0.08);
}
.login-brand { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 8px; }
.login-brand h1 { font-size: 22px; }
.login-brand p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.login-foot { margin-top: 18px; color: var(--muted); font-size: 12px; }

.role-tabs {
  display: flex; gap: 4px;
  background: #f1f3fa;
  border-radius: 10px;
  padding: 4px;
  margin: 16px 0 20px;
}
.role-tabs button {
  flex: 1;
  border: none; background: transparent;
  padding: 9px 0;
  border-radius: 8px;
  font-weight: 600; font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.role-tabs button.active { background: #fff; color: var(--primary-600); box-shadow: var(--shadow); }

.demo-accounts { margin-top: 16px; font-size: 13px; color: #4a5068; }
.demo-accounts summary { cursor: pointer; color: var(--primary-600); font-weight: 600; }
.demo-accounts p { margin: 6px 0 0; }

/* ================= 表单 ================= */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #3a4066; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-050);
}
.textarea { resize: vertical; min-height: 70px; }
.tex-row { display: flex; gap: 8px; align-items: flex-start; }
.tex-row .textarea { flex: 1; }
.tex-row .btn { flex-shrink: 0; margin-top: 2px; }
.bank-preview { border: 1px solid #e2e6f5; border-radius: 10px; padding: 12px 14px; background: #fafbff; min-height: 40px; }
.bank-preview .bp-prompt { font-size: 14px; line-height: 1.8; }
.bank-preview .bp-opts { margin-top: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; font-size: 14px; }
.bank-preview .bp-explain { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e2e6f5; color: #666; font-size: 13px; }
.input-sm, .select-sm { padding: 5px 8px; font-size: 13px; border-radius: 8px; }
.form-error { color: var(--red); font-size: 13px; min-height: 18px; margin-bottom: 6px; }

/* ================= 按钮 ================= */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: #fff;
  color: var(--text);
  border-color: var(--line);
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: #c9d2ea; background: #fafbff; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #c92a2a; }
.btn-danger-ghost { color: var(--red); border-color: #f3c2c2; background: #fff; }
.btn-danger-ghost:hover { background: var(--red-bg); border-color: #f0a8a8; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 11px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ================= 卡片 / 页面 ================= */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 15px; }
.card-head-right { display: flex; align-items: center; gap: 10px; flex: none; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h2 { font-size: 21px; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; gap: 10px; flex: none; }

.back-link { display: inline-block; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.back-link:hover { color: var(--primary-600); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-side { display: grid; grid-template-columns: 400px 1fr; gap: 16px; align-items: start; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 700; margin: 4px 0 2px; }
.stat-sub { font-size: 12px; color: var(--muted); }
.stat-card.tone-amber .stat-value { color: var(--amber); }
.stat-card.tone-green .stat-value { color: var(--green); }

/* ---- 学生端段位徽章 / 积分单位（我的战场） ---- */
.stat-unit { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 4px 0 2px;   /* 与 .stat-value 保持同一垂直节奏，卡片高度不变 */
  padding: 3px 12px 3px 8px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  color: #fff;
  box-shadow: 0 2px 6px rgba(35, 41, 70, 0.16);
  white-space: nowrap;
}
.rank-badge .icon { width: 16px; height: 16px; stroke-width: 2.2; }
.rank-king { background: linear-gradient(135deg, #ffc078, #e8590c); }
.rank-diamond { background: linear-gradient(135deg, #a5b4fc, #4c6ef5); }
.rank-platinum { background: linear-gradient(135deg, #99e9f2, #0b7285); }
.rank-gold { background: linear-gradient(135deg, #ffd43b, #f59f00); color: #6b4700; }
.rank-silver { background: linear-gradient(135deg, #dee2e6, #868e96); color: #343a40; }
.rank-bronze { background: linear-gradient(135deg, #e8a87c, #b05b2a); }

.quick-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.quick-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  background: #f8f9fe;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600; font-size: 13px;
  color: #3a4066;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.quick-btn:hover { border-color: var(--primary); color: var(--primary-600); background: var(--primary-050); }

.empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: #fafbfe;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

/* ================= 表格 ================= */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fafbfe;
  white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fafbff; }
.row-link { cursor: pointer; }
.td-actions { white-space: nowrap; }
.td-actions .btn { margin-right: 6px; }
.td-actions .btn:last-child { margin-right: 0; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }

/* ================= 徽章 / 进度条 ================= */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.b-green { color: var(--green); background: var(--green-bg); }
.b-amber { color: var(--amber); background: var(--amber-bg); }
.b-red { color: var(--red); background: var(--red-bg); }
.b-blue { color: var(--blue); background: var(--blue-bg); }
.b-gray { color: #495057; background: var(--gray-bg); }

.bar { height: 8px; background: #edf0f7; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--primary); transition: width 0.3s; }
.bar-fill.green { background: var(--green); }
.bar-fill.amber { background: var(--amber); }
.bar-fill.red { background: var(--red); }

/* ================= 选项卡 ================= */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
  border: none; background: none;
  padding: 9px 14px;
  font-weight: 600; font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--primary-600); }
.tab.active { color: var(--primary-600); border-bottom-color: var(--primary); }

/* ================= 班级卡片 ================= */
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.class-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.class-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.class-card-head h3 { font-size: 16px; }
.class-card-meta { font-size: 12px; color: var(--muted); }
.class-card-actions { display: flex; gap: 8px; margin-top: auto; }
.class-card-add {
  border: 1.5px dashed #c5cde8;
  background: transparent;
  color: var(--muted);
  font-weight: 600; font-size: 14px;
  align-items: center; justify-content: center;
  min-height: 130px;
  cursor: pointer;
  font-family: inherit;
}
.class-card-add:hover { border-color: var(--primary); color: var(--primary-600); background: var(--primary-050); }

/* ================= 教学内容 / 通知 ================= */
.post-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.post-item:last-child { border-bottom: none; }
.post-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.post-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.post-body { color: #4a5068; font-size: 13px; white-space: pre-wrap; }
.post-link { display: inline-block; margin-top: 6px; font-size: 13px; word-break: break-all; }
.post-actions { margin-top: 8px; }
.post-group { margin-bottom: 8px; }
.post-group-title { font-weight: 700; font-size: 13px; color: #3a4066; padding: 10px 0 4px; }

/* ================= 作业相关 ================= */
.detail-head p { color: #4a5068; margin-top: 6px; }
.detail-meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

.q-stat-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.q-stat-row:last-child { border-bottom: none; }
.q-stat-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.q-stat-prompt { font-size: 13px; color: #4a5068; margin-bottom: 8px; }

.q-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
  padding: 16px;
  margin-bottom: 14px;
}
.q-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.q-no {
  display: inline-block;
  background: var(--primary-050);
  color: var(--primary-600);
  font-size: 12px; font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  margin-right: 8px;
}
.q-card-tools { display: flex; align-items: center; gap: 8px; }
.q-prompt { font-weight: 600; margin-bottom: 12px; line-height: 1.7; }
.q-pts { float: right; font-size: 12px; color: var(--muted); font-weight: 500; }

.opt-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.opt-row:hover { border-color: var(--primary); }
.opt-row input { accent-color: var(--primary); width: 16px; height: 16px; flex: none; }

.opt-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.opt-edit-row { display: flex; align-items: center; gap: 10px; }
.opt-edit-row input[type="radio"], .opt-edit-row input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; flex: none; }
.opt-del {
  border: none; background: #f1f3fa;
  width: 28px; height: 28px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  flex: none;
  line-height: 1;
}
.opt-del:hover { background: var(--red-bg); color: var(--red); }

.fill-input { max-width: 420px; }

.sticky-actions {
  position: sticky;
  bottom: 0;
  background: rgba(244, 246, 251, 0.92);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 14px 4px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.sticky-actions .muted { margin-right: auto; }

/* ================= 成绩解析 ================= */
.result-card .result-head { display: flex; align-items: center; gap: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.result-score { font-size: 40px; font-weight: 800; line-height: 1; color: var(--primary-600); }
.result-score small { font-size: 16px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.result-score.green { color: var(--green); }
.result-score.amber { color: var(--amber); }
.result-score.red { color: var(--red); }
.result-meta { font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.teacher-fb {
  margin-top: 6px;
  background: var(--amber-bg);
  color: #9a5b00;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

.ans-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.ans-row:last-child { border-bottom: none; }
.ans-q { font-weight: 600; margin-bottom: 6px; line-height: 1.7; }
.ans-lines { padding-left: 12px; border-left: 3px solid var(--line); }
.ans-correct { color: var(--green); font-weight: 600; font-size: 13px; }
.ans-wrong { color: var(--red); font-weight: 600; font-size: 13px; }
.ans-detail { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; color: #4a5068; margin-top: 4px; }

/* ================= 学生端专用 ================= */
.welcome-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(120deg, #eef2ff, #f3f0ff);
  border-color: #dfe4fb;
}
.welcome-banner h2 { font-size: 20px; }
.welcome-banner p { color: #5b6178; font-size: 13px; margin-top: 2px; }
.welcome-logo {
  width: 58px; height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #7048e8);
  color: #fff; font-size: 30px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}

.task-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.task-row:last-child { border-bottom: none; }
.task-title { font-weight: 600; font-size: 14px; }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.task-side { display: flex; align-items: center; gap: 10px; flex: none; }

.notice { text-align: center; padding: 48px 20px; }
.notice h3 { font-size: 18px; margin-bottom: 8px; }
.notice p { margin-bottom: 16px; }

.fb-flag { color: var(--amber); font-weight: 600; font-size: 13px; }

/* ================= 弹窗 ================= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(23, 26, 45, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.18s;
  padding: 24px;
}
.modal-overlay.show { opacity: 1; }
.modal {
  background: #fff;
  border-radius: 16px;
  width: 480px; max-width: 100%;
  max-height: 86vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px);
  transition: transform 0.18s;
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-lg { width: 760px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: #fff; z-index: 2;
}
.modal-head h3 { font-size: 16px; }
.modal-close {
  border: none; background: none;
  font-size: 22px; line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.modal-close:hover { background: #f1f3fa; color: var(--text); }
.modal-body { padding: 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  position: sticky; bottom: 0; background: #fff;
}
.modal-text { color: #4a5068; line-height: 1.7; }

/* ================= Toast（悬浮固定底部，不占布局高度；重复触发多条叠加、各自独立消失） ================= */
#toast-wrap {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  max-width: min(90vw, 520px);
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s;
  pointer-events: auto;
  max-width: 100%;
  word-break: break-all;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ================= 评分 / 反馈 ================= */
.star-row { display: flex; gap: 4px; }
.star {
  border: none; background: none;
  font-size: 24px; line-height: 1;
  color: #d0d4e4;
  cursor: pointer;
  padding: 2px;
  transition: color 0.1s, transform 0.1s;
}
.star:hover { transform: scale(1.15); }
.star.on { color: #f5a623; }

.feedback-fab {
  position: fixed;
  left: 24px; bottom: 24px;
  z-index: 90;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 700; font-size: 14px;
  font-family: inherit;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(76, 110, 245, 0.35);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.feedback-fab:hover { background: var(--primary-600); transform: translateY(-2px); }

/* ================= 提问（不问白不问） ================= */
.ask-tip {
  margin: 0 0 12px; padding: 10px 12px;
  background: var(--primary-050); color: var(--primary-600);
  border-radius: 8px; font-weight: 600;
}
.ask-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.ask-item:last-child { border-bottom: none; }
.ask-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; font-size: 13px; }
.ask-text { white-space: pre-wrap; word-break: break-word; }
.ask-img { max-width: 220px; border-radius: 8px; margin-top: 8px; display: block; }
/* 问题/解答图片可点击放大 */
.ask-img { cursor: zoom-in; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.ask-img:hover { transform: scale(1.03); box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18); }
/* 答疑/解答视频：卡片内自适应宽度，可在线播放 */
.ask-video {
  display: block; margin-top: 8px;
  width: 100%; max-width: 480px;
  border-radius: 8px;
  background: #000;
}
/* 图片放大弹窗（全屏遮罩，图片等比缩放完整显示，桌面/移动自适应，无滚动条） */
.lightbox-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 12, 22, 0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 400;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.18s;
}
.lightbox-overlay.show { opacity: 1; }
.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 32px);
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  cursor: zoom-out;
  box-shadow: var(--shadow-lg);
}
.lightbox-close {
  position: absolute; top: 16px; right: 16px;
  width: 38px; height: 38px;
  border: none; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92); color: #333;
  font-size: 22px; line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 1;
}
.lightbox-close:hover { background: #fff; }
/* 移动端：缩小内边距，让图片占满更多空间 */
@media (max-width: 640px) {
  .lightbox-overlay { padding: 8px; }
  .lightbox-img { max-height: calc(100vh - 16px); border-radius: 6px; }
  .lightbox-close { top: 12px; right: 12px; width: 34px; height: 34px; }
}
.ask-answer {
  margin-top: 8px; padding: 10px 12px;
  background: var(--green-bg); border: 1px solid var(--green);
  border-radius: 8px; word-break: break-word;
}
.ask-answer-form { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.ask-answer-form .textarea { width: 100%; }
.ask-answer-form .field-hint { align-self: flex-start; }
/* 问题/解答中的自动识别链接 */
.ask-text a.lnk, .ask-answer a.lnk {
  color: var(--primary-600); font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px;
  word-break: break-all;
}
.ask-text a.lnk:hover, .ask-answer a.lnk:hover { color: var(--primary-700, var(--primary-600)); }
.ask-text a.lnk::after, .ask-answer a.lnk::after { content: ' ↗'; font-size: 0.85em; }

/* ================= 学生端听懂反馈 ================= */
.fb-bar { margin-top: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.fb-q { font-size: 13px; color: var(--muted, #6b7280); }
.fb-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff; color: var(--text, #1f2329);
  font-size: 13px; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.fb-btn:hover { border-color: var(--primary, #4c6ef5); color: var(--primary, #4c6ef5); }
.fb-btn.active {
  border-color: var(--primary, #4c6ef5);
  background: var(--primary, #4c6ef5); color: #fff;
}
.fb-emoji { font-size: 15px; line-height: 1; }
.fb-done { font-size: 12px; }

/* ================= 答案解析（教师上传，批改后学生可见） ================= */
.explain-box {
  margin-top: 8px; padding: 12px 14px;
  background: #f7f9ff; border: 1px solid #dbe2ff;
  border-radius: 10px;
}
.explain-title { font-size: 13px; font-weight: 600; color: var(--primary, #4c6ef5); margin-bottom: 4px; }
.explain-text { font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.explain-img {
  display: block; max-width: 100%; max-height: 320px;
  margin: 10px 0; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; cursor: zoom-in;
}
.explain-video {
  display: block; max-width: 100%; max-height: 320px;
  margin: 10px 0; border-radius: 10px; background: #000;
}
.inline-img { display: inline-block; vertical-align: middle; max-height: 2.6em; margin: 0 2px; cursor: zoom-in; }

/* ================= 题库 ================= */
.tag-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.bank-filter-wrap { margin-bottom: 16px; }
.bank-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
/* 学段 / 章节 两个下拉水平并列：必须覆盖 .select 的 width:100%（否则各占一行） */
.bank-filter .select { width: auto; min-width: 150px; max-width: 230px; }
/* 搜索框靠右（margin-left:auto 推到行尾） */
.bank-search { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.bank-search .input { width: 240px; }
.filter-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-bar .tabs { margin-bottom: 0; }
.tag-chip {
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--text); font-size: 13px; cursor: pointer;
  transition: all 0.15s ease;
}
.tag-chip:hover { border-color: var(--primary); color: var(--primary); }
.tag-chip.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.tag-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-check {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  font-size: 13px; cursor: pointer;
}
.tag-check input { accent-color: var(--primary); }
.bank-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.bank-item.is-selected { background: var(--primary-050); }
.bank-check { padding-top: 3px; flex-shrink: 0; cursor: pointer; }
.bank-check input { cursor: pointer; }
.bank-check-all { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; margin-right: 2px; }
.bank-check-all input { cursor: pointer; }
.bank-item:last-child { border-bottom: none; }
.bank-item-main { flex: 1; min-width: 0; }
.bank-item-head { display: flex; align-items: center; gap: 8px; }
.bank-prompt { font-weight: 600; font-size: 14px; word-break: break-word; }
.bank-item-meta { margin-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bank-item-actions { display: flex; gap: 6px; flex: none; }
/* 导入预览：题库归类区块（预览列表下方） */
.imp-classify {
  margin-top: 16px; padding: 12px 14px;
  border: 1px dashed var(--line); border-radius: 10px; background: var(--primary-050);
}
.imp-classify-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.imp-classify-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.imp-cls-label { font-size: 13px; color: var(--muted, #666); white-space: nowrap; }
.imp-classify-row .select { width: auto; min-width: 150px; max-width: 230px; }
.bank-pick-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line);
  margin-bottom: 8px; cursor: pointer;
}
.bank-pick-item:hover { background: #f4f6fb; }
.bank-pick-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.bank-pick-prompt { font-size: 13px; word-break: break-word; }
.bank-pick-tags { flex: none; }
.bank-opt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bank-opt-row .input { flex: 1; }

/* ================= 错题本 ================= */
.wb-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.wb-item:last-child { border-bottom: none; }
.wb-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.wb-prompt { font-weight: 600; font-size: 14px; line-height: 1.6; word-break: break-word; }
.wb-opt { font-size: 13px; color: var(--text); margin-top: 4px; }
.wb-explain {
  margin-top: 10px; padding: 10px 12px;
  background: #f7f9ff; border: 1px solid #dbe2ff; border-radius: 10px;
}
.wb-actions { margin-top: 10px; display: flex; gap: 8px; align-items: center; }
.wb-practice-box { margin-top: 10px; }
.wb-practice {
  padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #fbfbfe;
  display: flex; flex-direction: column; gap: 10px;
}
.wb-practice .opt-row { margin: 0; }

/* ================= 响应式（窄屏收缩侧栏） ================= */
@media (max-width: 960px) {
  .sidebar { width: 64px; }
  .brand-name, .nav-item span, .sidebar-foot { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .brand { justify-content: center; }
  .grid-2, .grid-side { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 16px; }
}

/* ================= 图片上传（题干配图 / 解答题作答图） ================= */
.q-image {
  display: block;
  max-width: 100%;
  max-height: 280px;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin: 2px 0 10px;
  background: #fff;
}
.img-upload { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.img-upload .img-hint { font-size: 12px; }
.img-preview { position: relative; display: inline-block; margin-top: 8px; }
.img-preview img {
  max-width: 220px; max-height: 160px;
  border-radius: 10px; border: 1px solid var(--line);
  display: block; background: #fff;
}
.video-preview { position: relative; display: inline-block; margin-top: 8px; max-width: 100%; }
.video-preview video {
  max-width: 360px; max-height: 200px;
  border-radius: 10px; border: 1px solid var(--line);
  display: block; background: #000;
}
/* 视频上传进度条 */
.progress-track {
  display: flex; align-items: center; gap: 8px;
  width: 100%; max-width: 360px; margin-top: 4px;
  padding: 5px 8px; border-radius: 8px;
  background: var(--line, #e5e7eb);
}
.progress-track[hidden] { display: none; }
.progress-bar {
  flex: 1; height: 6px; border-radius: 3px;
  background: var(--primary, #4c6ef5);
  width: 0%;
  transition: width 0.2s ease;
}
.progress-text { font-size: 12px; min-width: 36px; text-align: right; }
/* 答疑表单操作区（取消/保存修改/提交） */
.form-actions { display: flex; gap: 8px; }
.img-remove {
  position: absolute; top: -8px; right: -8px;
  width: 22px; height: 22px;
  border: none; border-radius: 50%;
  background: var(--red); color: #fff;
  font-size: 13px; line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.img-remove:hover { background: #c92a2a; }

/* ================= 解答题 ================= */
.essay-note { font-size: 12px; color: var(--muted); margin: -4px 0 10px; }
.essay-answer { margin-top: 8px; }
.ans-text {
  white-space: pre-wrap;
  background: #f7f8fc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  line-height: 1.7;
  margin-top: 6px;
}
.ans-image {
  display: block;
  max-width: 340px; max-height: 260px;
  border-radius: 10px; border: 1px solid var(--line);
  margin-top: 8px; background: #fff;
}
.ans-pending { color: var(--amber); font-weight: 600; }
.essay-ref {
  font-size: 13px; color: #4a5068;
  background: var(--amber-bg);
  border: 1px solid #f3e2a8;
  border-radius: 10px;
  padding: 8px 12px;
  margin-top: 8px;
}
.grade-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.grade-row label { font-size: 13px; font-weight: 600; color: #3a4066; }
.grade-input { width: 84px; }

/* ================= 个人中心 ================= */
.avatar { overflow: hidden; }
.avatar .avatar-svg { display: block; width: 100%; height: 100%; }

.profile-avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 4px 0 18px; }
.profile-avatar-big {
  width: 84px; height: 84px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 2px solid var(--line);
  box-shadow: 0 6px 18px rgba(60, 72, 120, .12);
  color: #fff; font-size: 30px; font-weight: 600;
  overflow: hidden;
}
.profile-avatar-big .avatar-svg { width: 76px; height: 76px; display: block; }
.profile-avatar-big.has-avatar { background: #fff; }

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.avatar-pick {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px 6px;
  background: #fbfcff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
  font: inherit;
}
.avatar-pick span { font-size: 11px; color: var(--muted); }
.avatar-pick:hover { border-color: #c7d0f0; background: #f4f6fd; transform: translateY(-1px); }
.avatar-pick.active { border-color: var(--primary); background: #eef1ff; box-shadow: 0 0 0 3px rgba(90, 103, 216, .12); }
.avatar-pick.active span { color: var(--primary-600); font-weight: 600; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.info-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.info-row:last-of-type { border-bottom: none; }
.info-label { color: var(--muted); }
.info-value { font-weight: 600; color: #2c3452; }

.profile-sec-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: #fbfcff; margin-bottom: 10px;
}
.profile-sec-row b { font-size: 13px; }
.profile-sec-row p { margin: 2px 0 0; }

.name-cell { display: inline-flex; align-items: center; gap: 8px; }
.row-avatar {
  width: 26px; height: 26px; flex: none;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary), #7048e8);
  color: #fff; font-size: 12px; font-weight: 600;
}
.row-avatar .avatar-svg { display: block; width: 100%; height: 100%; }

/* ================= 个人中心新布局（左信息 / 右课时） ================= */
.profile-grid { display: grid; grid-template-columns: 400px 1fr; gap: 16px; align-items: start; }
/* 关键：grid 子项默认 min-width:auto（=内容最小宽度），会让 1fr 列被宽表格撑大导致页面横向溢出；
   设 min-width:0 让右列可压缩，配合 .table-wrap 的 overflow-x:auto 在列内滚动，页面不再被撑宽 */
.profile-grid > .profile-col { min-width: 0; }
.profile-grid-single { grid-template-columns: 1fr; max-width: 900px; margin: 0 auto; }
.profile-col { display: flex; flex-direction: column; }
.profile-col .card { margin-bottom: 16px; }
.profile-col .card:last-child { margin-bottom: 0; }

/* 头像：点击触发悬浮面板 */
.avatar-field { position: relative; display: flex; flex-direction: column; align-items: center; }
/* 头像设置：用户头像左右两侧的宠物切换头像（尺寸 = 大头像 50%） */
.avatar-pet-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
}
.pet-avatar-pick {
  width: 44px; height: 44px;
  margin-top: 22px;                     /* (88-44)/2：与 88px 大头像垂直居中对齐 */
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.pet-avatar-pick img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.pet-avatar-pick:hover { border-color: var(--primary); transform: scale(1.08); }
.pet-avatar-pick.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(90, 103, 216, .18);
  transform: scale(1.08);
}
.profile-avatar-trigger {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: none; background: none; padding: 0; cursor: pointer;
  font: inherit; color: inherit;
}
.profile-avatar-trigger .profile-avatar-big {
  width: 88px; height: 88px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.profile-avatar-trigger:hover .profile-avatar-big { border-color: var(--primary); transform: translateY(-2px); }
.profile-avatar-trigger:focus-visible { outline: none; }
.profile-avatar-trigger:focus-visible .profile-avatar-big { box-shadow: 0 0 0 3px var(--primary-050); }
.avatar-trigger-hint { font-size: 12px; color: var(--primary); font-weight: 600; }
.avatar-current { margin-top: 10px; text-align: center; }

.avatar-popover {
  position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  margin-top: 10px;
  width: 300px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 14px;
  z-index: 20;
}
.avatar-popover::before {
  content: ''; position: absolute; top: -7px; left: 50%;
  margin-left: -7px; width: 12px; height: 12px;
  background: #fff; border-left: 1px solid var(--line); border-top: 1px solid var(--line);
  transform: rotate(45deg);
}
.avatar-popover-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 600; margin-bottom: 10px;
}
.avatar-grid-pop { grid-template-columns: repeat(5, 1fr); gap: 8px; }
.avatar-grid-pop .avatar-pick { padding: 6px 2px; }
.avatar-popover-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* ================= 课时 ================= */
.credit-hero {
  display: flex; align-items: center; gap: 20px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, #f3f6ff, #fafcff);
}
.credit-hero.tone-amber { background: linear-gradient(135deg, var(--amber-bg), #fffdf7); border-color: #f3e2a8; }
.credit-hero.tone-red { background: linear-gradient(135deg, var(--red-bg), #fffafa); border-color: #f3c2c2; }
.credit-hero-value {
  font-size: 42px; font-weight: 700; line-height: 1.1;
  color: var(--primary-600); flex: none;
}
.credit-hero.tone-amber .credit-hero-value { color: var(--amber); }
.credit-hero.tone-red .credit-hero-value { color: var(--red); }
.credit-hero-value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.credit-hero-side { display: flex; flex-direction: column; gap: 4px; }

.credit-cell b { font-size: 14px; }
.credit-cell-warn b { color: var(--amber); }
.credit-cell-low b { color: var(--red); }
.credit-plus { color: var(--green); }
.credit-minus { color: var(--red); }
.credit-note { color: #4a5068; white-space: normal; min-width: 140px; }
.nowrap { white-space: nowrap; }
/* 长文本教学反馈：默认折叠 + 展开按钮 */
.cn-toggle {
  margin-left: 6px;
  border: 0; background: none; padding: 0;
  color: var(--primary); font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.cn-toggle:hover { text-decoration: underline; }

/* 课时记录分页 */
.pager {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; font-size: 12px;
}
.pager-pages { display: flex; align-items: center; gap: 4px; }
.pager .btn-sm { min-width: 30px; }
.pager button[disabled] { opacity: .5; cursor: not-allowed; }

/* 课时弹窗 */
.credit-tip {
  background: var(--primary-050);
  border: 1px solid #d5ddfb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px; color: #3a4066;
  margin-bottom: 16px;
}
.credit-tip b { color: var(--primary-600); font-size: 15px; }

.radio-switch { display: flex; gap: 10px; }
.rs-item {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fbfcff;
  cursor: pointer;
  font-size: 13px; font-weight: 600;
  transition: border-color .15s, background .15s;
}
.rs-item:hover { border-color: #c7d0f0; }
.rs-item.active { border-color: var(--primary); background: #eef1ff; color: var(--primary-600); }
.rs-item input { accent-color: var(--primary); }
.rs-tag {
  font-style: normal; font-size: 11px; font-weight: 600;
  background: var(--primary); color: #fff;
  border-radius: 999px; padding: 1px 7px;
}
.field-counter { font-size: 12px; color: var(--muted); margin-top: 6px; text-align: right; }
.field-hint { font-size: 12px; color: var(--amber); margin-top: 4px; text-align: right; min-height: 16px; }

@media (max-width: 960px) {
  .profile-grid { grid-template-columns: 1fr; }
  .avatar-popover { width: 280px; }
}

/* ================= 积分商城 ================= */
.mall-thumb {
  width: 40px; height: 40px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #f3f4fb; overflow: hidden; flex: none;
  border: 1px solid var(--line);
}
.mall-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mall-thumb-empty { color: var(--muted); font-size: 11px; }

.mall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.mall-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  display: flex; flex-direction: column;
  transition: box-shadow .15s, transform .15s;
}
.mall-card:hover { box-shadow: 0 8px 24px rgba(35, 41, 70, .10); transform: translateY(-2px); }
.mall-card-img {
  aspect-ratio: 4 / 3;
  background: #f3f4fb;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.mall-card-img img { width: 100%; height: 100%; object-fit: cover; }
.mall-card-placeholder { color: var(--muted); font-size: 13px; }
.mall-card-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.mall-card-name { font-weight: 600; font-size: 14px; color: #2c3452; }
.mall-card-desc { font-size: 12px; line-height: 1.5; }
.mall-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 6px; }
.mall-points { color: var(--amber); font-weight: 700; font-size: 15px; }

/* ================= 互动宠物（悬浮右下角，可点击/拖拽/记忆位置） ================= */
.pet {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 300;
  width: 64px; height: 64px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.pet.hidden { display: none; }
.pet.dragging { cursor: grabbing; }
.pet-avatar {
  width: 64px; height: 64px;
  display: block;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffffff, #e8ecf6);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18), inset 0 -3px 8px rgba(0, 0, 0, 0.06);
  animation: pet-idle 2.4s ease-in-out infinite;
  transition: transform 0.2s ease;
  overflow: hidden;
  cursor: grab;
}
.pet-avatar img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.pet.dragging .pet-avatar { animation: none; transform: scale(1.12); }
.pet-avatar.tap { animation: pet-tap 0.5s ease; }
.pet-bubble {
  position: absolute;
  background: #fff;
  color: #333;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 13px;
  line-height: 1.6;
  white-space: normal;
  word-break: break-word;
  text-align: center;
  max-width: 220px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
/* 云朵顶部凸起（两个泡泡） */
.pet-bubble::before {
  content: '';
  position: absolute;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  top: -12px; left: 18px;
  box-shadow: 34px 2px 0 -4px #fff;
}
/* 方向一：宠物在左半屏，气泡向右弹（异侧），尾巴在气泡左侧指向宠物 */
.pet-bubble.side-right {
  left: calc(100% + 16px);
  top: 50%;
  transform: translateY(-50%) translateX(-8px);
}
.pet-bubble.side-right::after {
  content: '';
  position: absolute;
  top: 50%; right: 100%;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-right-color: #fff;
}
.pet-bubble.show { opacity: 1; }
.pet-bubble.side-right.show { transform: translateY(-50%) translateX(0); }
/* 方向二：宠物在右半屏，气泡向左弹（异侧），尾巴在气泡右侧指向宠物 */
.pet-bubble.side-left {
  right: calc(100% + 16px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
}
.pet-bubble.side-left::after {
  content: '';
  position: absolute;
  top: 50%; left: 100%;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-left-color: #fff;
}
.pet-bubble.side-left.show { transform: translateY(-50%) translateX(0); }

@keyframes pet-idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes pet-tap {
  0% { transform: scale(1); }
  30% { transform: scale(1.22) rotate(-10deg); }
  60% { transform: scale(0.94) rotate(8deg); }
  100% { transform: scale(1); }
}
