/* ============================================================
   错题本 · 设计系统
   ============================================================ */

:root {
  --brand-50:  #eff6ff;
  --brand-100: #dbeafe;
  --brand-200: #bfdbfe;
  --brand-300: #93c5fd;
  --brand-400: #60a5fa;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e40af;

  --amber-50: #fffbeb;
  --amber-100:#fef3c7;
  --amber-400:#fbbf24;
  --amber-500:#f59e0b;
  --amber-600:#d97706;
  --amber-700:#b45309;

  --green-50: #f0fdf4;
  --green-100:#dcfce7;
  --green-500:#22c55e;
  --green-600:#16a34a;
  --green-700:#15803d;

  --red-50:  #fef2f2;
  --red-100: #fee2e2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  --purple-50:#f5f3ff;
  --purple-100:#ede9fe;
  --purple-600:#7c3aed;

  --ink-900: #0f172a;
  --ink-800: #1e293b;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #cbd5e1;
  --ink-200: #e2e8f0;
  --ink-100: #f1f5f9;
  --ink-50:  #f8fafc;

  --bg: #f5f7fb;
  --surface: #ffffff;
  --line: #e6ebf2;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 4px 14px rgba(15, 23, 42, .07);
  --shadow-lg: 0 12px 34px rgba(15, 23, 42, .11);
  --shadow-xl: 0 24px 60px rgba(15, 23, 42, .16);

  --topbar-h: 60px;
  --sidebar-w: 244px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
          "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-800);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; color: var(--ink-900); line-height: 1.35; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.03rem; }
p { margin: 0; }
small { font-size: .8125rem; }
ul { margin: 0; padding: 0; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

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

[hidden] { display: none !important; }

::selection { background: var(--brand-200); }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--ink-300) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-400); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   启动遮罩
   ============================================================ */

.boot {
  position: fixed; inset: 0; z-index: 999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--bg);
  transition: opacity .3s var(--ease);
}
.boot.is-gone { opacity: 0; pointer-events: none; }
.boot-logo { font-size: 46px; animation: boot-bounce 1.4s var(--ease) infinite; }
.boot-text { color: var(--ink-500); font-size: .9rem; }
@keyframes boot-bounce {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-12px) rotate(4deg); }
}

/* ============================================================
   登录 / 注册
   ============================================================ */

.auth-screen { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }

.auth-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(145deg, var(--brand-700) 0%, var(--brand-600) 42%, #4f46e5 100%);
  color: #fff; display: flex; align-items: center;
}
.auth-hero::before,
.auth-hero::after {
  content: ''; position: absolute; border-radius: 50%; pointer-events: none;
}
.auth-hero::before {
  width: 460px; height: 460px; right: -160px; top: -140px;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 68%);
}
.auth-hero::after {
  width: 380px; height: 380px; left: -120px; bottom: -150px;
  background: radial-gradient(circle, rgba(251,191,36,.26), transparent 70%);
}
.auth-hero-inner { position: relative; z-index: 1; padding: 56px 60px; max-width: 560px; }
.brand-mark { font-size: 52px; line-height: 1; margin-bottom: 18px; }
.auth-hero h1 { font-size: 2.5rem; color: #fff; letter-spacing: -.02em; margin-bottom: 12px; }
.tagline { font-size: 1.03rem; color: rgba(255,255,255,.9); margin-bottom: 34px; }

.hero-points { list-style: none; display: grid; gap: 18px; margin-bottom: 30px; }
.hero-points li { display: flex; gap: 14px; align-items: flex-start; }
.hero-ico {
  flex: 0 0 42px; height: 42px; display: grid; place-items: center; font-size: 19px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); border-radius: 12px;
  backdrop-filter: blur(6px);
}
.hero-points strong { display: block; font-size: .97rem; margin-bottom: 2px; }
.hero-points small { color: rgba(255,255,255,.76); line-height: 1.5; display: block; font-size: .845rem; }
.hero-note {
  font-size: .84rem; color: rgba(255,255,255,.72);
  padding-top: 18px; border-top: 1px solid rgba(255,255,255,.18);
}

.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 420px; }

.auth-tabs {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 28px;
  background: var(--ink-100); border-radius: var(--radius);
}
.auth-tab {
  flex: 1; padding: 9px 0; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-500); font-weight: 600; font-size: .92rem;
  transition: all .18s var(--ease);
}
.auth-tab.is-active { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-sm); }

.auth-form h2 { margin-bottom: 6px; }
.form-sub { color: var(--ink-500); font-size: .875rem; margin-bottom: 24px; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: .845rem; font-weight: 600; color: var(--ink-700); margin-bottom: 6px; }
.field > span em { font-style: normal; font-weight: 400; color: var(--ink-400); font-size: .92em; }
.field input, .field select, .field textarea,
.input, .select, .textarea {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--ink-200); border-radius: var(--radius-sm);
  background: var(--surface); font-size: .94rem;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus,
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100);
}
.field input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
select.input, select.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px;
}

.form-error {
  padding: 9px 12px; margin-bottom: 14px; border-radius: var(--radius-sm);
  background: var(--red-50); border: 1px solid var(--red-100);
  color: var(--red-700); font-size: .86rem;
}
.form-foot { text-align: center; margin-top: 18px; font-size: .875rem; color: var(--ink-500); }
.link { border: 0; background: none; color: var(--brand-600); font-weight: 600; padding: 0; }
.link:hover { text-decoration: underline; }

/* ============================================================
   按钮
   ============================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 17px; border: 1.5px solid transparent; border-radius: var(--radius-sm);
  font-size: .9125rem; font-weight: 600; white-space: nowrap;
  transition: all .16s var(--ease); text-decoration: none !important;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.3); }
.btn-primary:hover:not(:disabled) { background: var(--brand-700); box-shadow: 0 3px 10px rgba(37,99,235,.28); }
.btn-ghost { background: var(--surface); color: var(--ink-700); border-color: var(--ink-200); }
.btn-ghost:hover:not(:disabled) { background: var(--ink-50); border-color: var(--ink-300); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); }
.btn-soft:hover:not(:disabled) { background: var(--brand-100); }
.btn-danger { background: var(--red-50); color: var(--red-700); border-color: var(--red-100); }
.btn-danger:hover:not(:disabled) { background: var(--red-100); }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 24px; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: 6px 12px; font-size: .845rem; }

.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-600);
  transition: background .16s var(--ease);
}
.icon-btn:hover { background: var(--ink-100); }

/* ============================================================
   顶栏
   ============================================================ */

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  background: rgba(255,255,255,.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-menu { display: none; }
.topbar-brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 1.06rem; color: var(--ink-900); text-decoration: none !important;
  letter-spacing: -.01em;
}
.brand-mark-sm { font-size: 22px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.ai-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 99px;
  font-size: .755rem; font-weight: 700; letter-spacing: .01em;
  background: var(--amber-100); color: var(--amber-700);
  border: 1px solid #fde68a; cursor: help;
}
.ai-badge.is-live { background: var(--green-100); color: var(--green-700); border-color: #bbf7d0; }
.ai-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.student-switch { position: relative; }
.student-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 11px; border: 1.5px solid var(--ink-200); border-radius: 99px;
  background: var(--surface); font-size: .86rem; font-weight: 600; color: var(--ink-700);
  transition: all .16s var(--ease); max-width: 190px;
}
.student-chip:hover { border-color: var(--brand-300); background: var(--brand-50); }
.student-chip .chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-chip .chip-grade { color: var(--ink-400); font-weight: 500; font-size: .78rem; }

.popover {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.popover-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 11px; border: 0; border-radius: var(--radius-sm);
  background: transparent; text-align: left; font-size: .89rem;
  transition: background .14s var(--ease);
}
.popover-item:hover { background: var(--ink-100); }
.popover-item.is-active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.popover-item small { color: var(--ink-400); margin-left: auto; font-weight: 400; }

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px; border: 1.5px solid var(--ink-200); border-radius: 99px;
  background: var(--surface); transition: all .16s var(--ease);
}
.user-btn:hover { border-color: var(--brand-300); background: var(--brand-50); }
.avatar {
  width: 27px; height: 27px; display: grid; place-items: center;
  border-radius: 50%; background: linear-gradient(135deg, var(--brand-500), #6366f1);
  color: #fff; font-size: .82rem;
}
.user-name { font-size: .875rem; font-weight: 600; color: var(--ink-700); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 240px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.user-dropdown-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-dropdown-head strong { display: block; font-size: .93rem; }
.user-dropdown-head small { color: var(--ink-400); font-size: .8rem; word-break: break-all; }
.dd-role {
  display: inline-block; margin-top: 6px;
  padding: 1.5px 8px; border-radius: 99px;
  font-size: .7rem; font-weight: 700;
  background: var(--purple-100); color: var(--purple-600);
}
.user-dropdown button, .user-dropdown a {
  display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--radius-sm);
  background: transparent; text-align: left; font-size: .885rem; color: var(--ink-700);
  text-decoration: none !important; transition: background .14s var(--ease);
}
.user-dropdown button:hover, .user-dropdown a:hover { background: var(--ink-100); }
.user-dropdown .danger { color: var(--red-600); }
.user-dropdown .danger:hover { background: var(--red-50); }

/* ============================================================
   布局与侧栏
   ============================================================ */

.layout { flex: 1; display: flex; align-items: flex-start; }

.sidebar {
  position: sticky; top: var(--topbar-h); z-index: 40;
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 12px;
  background: var(--surface); border-right: 1px solid var(--line);
  overflow-y: auto;
}
.side-nav { display: grid; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--ink-600); font-size: .905rem; font-weight: 500;
  text-decoration: none !important; transition: all .15s var(--ease);
}
.side-link:hover { background: var(--ink-100); color: var(--ink-900); }
.side-link.is-active { background: var(--brand-600); color: #fff; font-weight: 600; box-shadow: 0 2px 8px rgba(37,99,235,.24); }
.side-ico { font-size: 1.05rem; width: 20px; text-align: center; }

.side-section { margin-top: 20px; }
.side-title {
  padding: 0 12px 8px; font-size: .715rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-400);
}
.side-students { display: grid; gap: 2px; }
.side-student {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 12px; border: 0; border-radius: var(--radius-sm);
  background: transparent; text-align: left; transition: background .15s var(--ease);
}
.side-student:hover { background: var(--ink-100); }
.side-student.is-active { background: var(--brand-50); }
.side-student .stu-av { font-size: 1.05rem; }
.side-student .stu-info { min-width: 0; flex: 1; }
.side-student .stu-name { display: block; font-size: .885rem; font-weight: 600; color: var(--ink-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-student .stu-meta { display: block; font-size: .74rem; color: var(--ink-400); }
.side-student .stu-count {
  font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 99px;
  background: var(--ink-100); color: var(--ink-500);
}
.side-student.is-active .stu-count { background: var(--brand-100); color: var(--brand-700); }
.side-empty { padding: 4px 12px 10px; font-size: .82rem; color: var(--ink-400); }

.side-foot { margin-top: auto; padding: 16px 12px 4px; border-top: 1px solid var(--line); }
.side-mode { font-size: .755rem; color: var(--ink-400); margin-bottom: 4px; }
.side-foot small { color: var(--ink-300); font-size: .72rem; }

.content { flex: 1; min-width: 0; padding: 26px 30px 70px; }

/* ============================================================
   通用页面元素
   ============================================================ */

.page-head {
  display: flex; align-items: flex-start; gap: 16px;
  flex-wrap: wrap; margin-bottom: 22px;
}
.page-head .ph-text { flex: 1; min-width: 220px; }
.page-head h1 { margin-bottom: 4px; }
.page-desc { color: var(--ink-500); font-size: .9rem; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
}
.card-pad { padding: 20px 22px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { flex: 1; min-width: 0; }
.card-body { padding: 20px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line); background: var(--ink-50); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.muted { color: var(--ink-500); }
.small { font-size: .845rem; }
.mono { font-family: var(--font-mono); font-size: .86em; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2.5px 9px; border-radius: 99px;
  font-size: .765rem; font-weight: 600; white-space: nowrap;
  background: var(--ink-100); color: var(--ink-600);
}
.tag-brand  { background: var(--brand-50);  color: var(--brand-700); }
.tag-amber  { background: var(--amber-100); color: var(--amber-700); }
.tag-green  { background: var(--green-100); color: var(--green-700); }
.tag-red    { background: var(--red-100);   color: var(--red-700); }
.tag-purple { background: var(--purple-100);color: var(--purple-600); }
.tag-lg { padding: 4px 12px; font-size: .82rem; }

/* 空状态 */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 54px 24px; text-align: center;
}
.empty-ico { font-size: 44px; line-height: 1; opacity: .85; }
.empty h3 { font-size: 1.05rem; }
.empty p { color: var(--ink-500); font-size: .895rem; max-width: 400px; }

/* 加载 */
.skeleton {
  background: linear-gradient(90deg, var(--ink-100) 25%, var(--ink-200) 37%, var(--ink-100) 63%);
  background-size: 400% 100%; border-radius: var(--radius-sm);
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skel-line { height: 13px; margin-bottom: 9px; }
.skel-line.w60 { width: 60%; } .skel-line.w80 { width: 80%; } .skel-line.w40 { width: 40%; }

.spinner {
  width: 17px; height: 17px; flex: 0 0 auto;
  border: 2.2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.spinner-lg { width: 30px; height: 30px; border-width: 3px; color: var(--brand-500); }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-block {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 60px 20px; color: var(--ink-500); font-size: .9rem;
}

/* ============================================================
   统计卡
   ============================================================ */

.stat {
  position: relative; overflow: hidden;
  padding: 18px 20px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-xs);
}
.stat-label { font-size: .8rem; color: var(--ink-500); font-weight: 600; margin-bottom: 6px; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--ink-900); line-height: 1.15; letter-spacing: -.02em; }
.stat-value small { font-size: .9rem; font-weight: 600; color: var(--ink-400); margin-left: 3px; }
.stat-foot { font-size: .78rem; color: var(--ink-400); margin-top: 6px; }
.stat-ico {
  position: absolute; right: 14px; top: 12px; font-size: 26px; opacity: .16;
}
.stat.is-brand { background: linear-gradient(150deg, var(--brand-600), #4f46e5); border-color: transparent; }
.stat.is-brand .stat-label, .stat.is-brand .stat-foot { color: rgba(255,255,255,.78); }
.stat.is-brand .stat-value { color: #fff; }
.stat.is-brand .stat-value small { color: rgba(255,255,255,.7); }
.stat.is-brand .stat-ico { opacity: .28; }

/* ============================================================
   学生卡
   ============================================================ */

.student-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 20px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-xs); transition: all .18s var(--ease);
}
.student-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--brand-200); }
.student-card-top { display: flex; align-items: center; gap: 13px; }
.student-av {
  width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center;
  font-size: 24px; border-radius: 14px;
  background: linear-gradient(140deg, var(--brand-100), var(--purple-100));
}
.student-card h3 { margin-bottom: 2px; }
.student-card .sc-meta { font-size: .82rem; color: var(--ink-500); }
.student-card-stats { display: flex; gap: 18px; padding-top: 13px; border-top: 1px solid var(--line); }
.sc-stat { text-align: left; }
.sc-stat b { display: block; font-size: 1.12rem; font-weight: 800; color: var(--ink-800); line-height: 1.2; }
.sc-stat small { font-size: .755rem; color: var(--ink-400); }

.bar { height: 7px; border-radius: 99px; background: var(--ink-100); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-500), #6366f1); transition: width .5s var(--ease); }
.bar.is-green > i { background: linear-gradient(90deg, var(--green-500), #34d399); }
.bar.is-amber > i { background: linear-gradient(90deg, var(--amber-400), var(--amber-500)); }
.bar.is-red > i { background: linear-gradient(90deg, var(--red-500), #f87171); }

/* ============================================================
   错题列表
   ============================================================ */

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 13px 18px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.filters .input, .filters .select { width: auto; min-width: 130px; padding: 7px 11px; font-size: .875rem; }
.search-wrap { position: relative; flex: 1; min-width: 190px; }
.search-wrap .input { width: 100%; padding-left: 34px; }
.search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-400); pointer-events: none; }

.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 5px 13px; border: 1.5px solid var(--ink-200); border-radius: 99px;
  background: var(--surface); font-size: .845rem; font-weight: 500; color: var(--ink-600);
  transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--brand-300); color: var(--brand-700); }
.chip.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; font-weight: 600; }

.mistake-list { display: grid; gap: 13px; }

.mistake-card {
  display: flex; gap: 16px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
  transition: all .18s var(--ease); cursor: pointer;
}
.mistake-card:hover { box-shadow: var(--shadow); border-color: var(--brand-200); }
.mistake-thumb {
  position: relative; flex: 0 0 96px; width: 96px; height: 96px;
  border-radius: var(--radius); overflow: hidden;
  background: var(--ink-100); border: 1px solid var(--line);
}
.mistake-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mistake-thumb .thumb-count {
  position: absolute; right: 4px; bottom: 4px;
  padding: 1px 6px; border-radius: 99px; font-size: .68rem; font-weight: 700;
  background: rgba(15,23,42,.72); color: #fff;
}
.mistake-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.mistake-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: .945rem; font-weight: 600; color: var(--ink-800);
  line-height: 1.5;
}
.mistake-diagnosis {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: .845rem; color: var(--ink-600);
}
.mistake-diagnosis .diag-ico { flex: 0 0 auto; }
.mistake-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 5px; }
.mistake-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-300); }
.mistake-time { font-size: .775rem; color: var(--ink-400); }

/* 处理中 */
.mistake-card.is-running { border-color: var(--amber-400); background: linear-gradient(180deg, var(--amber-50), var(--surface) 60%); }
.run-progress { display: flex; align-items: center; gap: 10px; }
.run-progress .bar { flex: 1; }
.run-progress span { font-size: .79rem; font-weight: 700; color: var(--amber-700); white-space: nowrap; }

/* ============================================================
   上传页
   ============================================================ */

.upload-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }

.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 46px 24px; text-align: center; cursor: pointer;
  background: var(--surface); border: 2.5px dashed var(--ink-300); border-radius: var(--radius-xl);
  transition: all .2s var(--ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand-500); background: var(--brand-50); }
.dropzone.is-over { transform: scale(1.008); }
.dz-ico { font-size: 46px; line-height: 1; }
.dropzone h3 { font-size: 1.08rem; }
.dropzone p { color: var(--ink-500); font-size: .875rem; }
.dz-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.preview-item {
  position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius);
  overflow: hidden; background: var(--ink-100); border: 1px solid var(--line);
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-remove {
  position: absolute; right: 6px; top: 6px; width: 26px; height: 26px;
  display: grid; place-items: center; border: 0; border-radius: 50%;
  background: rgba(15,23,42,.7); color: #fff; font-size: 15px; line-height: 1;
  backdrop-filter: blur(4px); transition: background .15s var(--ease);
}
.preview-remove:hover { background: var(--red-600); }
.preview-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 8px 6px;
  font-size: .7rem; color: #fff; background: linear-gradient(transparent, rgba(15,23,42,.82));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-item.is-add { display: grid; place-items: center; border-style: dashed; border-width: 2px; cursor: pointer; color: var(--ink-400); }
.preview-item.is-add:hover { border-color: var(--brand-400); color: var(--brand-600); background: var(--brand-50); }

.subject-picker { display: flex; gap: 7px; flex-wrap: wrap; }
.subject-pick {
  padding: 6px 14px; border: 1.5px solid var(--ink-200); border-radius: 99px;
  background: var(--surface); font-size: .865rem; font-weight: 500; color: var(--ink-600);
  transition: all .15s var(--ease);
}
.subject-pick:hover { border-color: var(--brand-300); }
.subject-pick.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; font-weight: 600; }

/* 处理步骤动画 */
.pipeline { display: grid; gap: 4px; }
.pipe-step {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: var(--radius);
  font-size: .89rem; color: var(--ink-400);
  transition: all .25s var(--ease);
}
.pipe-step .pipe-dot {
  width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center;
  border-radius: 50%; font-size: .68rem; font-weight: 700;
  background: var(--ink-100); color: var(--ink-400);
}
.pipe-step.is-done { color: var(--ink-600); }
.pipe-step.is-done .pipe-dot { background: var(--green-100); color: var(--green-700); }
.pipe-step.is-active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.pipe-step.is-active .pipe-dot { background: var(--brand-600); color: #fff; }

/* ============================================================
   错因诊断
   ============================================================ */

.diagnosis {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg); border: 1px solid var(--amber-100);
  background: linear-gradient(160deg, var(--amber-50), var(--surface) 55%);
}
.diagnosis-head { padding: 20px 22px 16px; }
.diag-top { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.diag-badge {
  display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 14px; font-size: 22px; background: var(--amber-100);
}
.diag-summary { flex: 1; min-width: 200px; }
.diag-summary h2 { font-size: 1.12rem; margin-bottom: 7px; line-height: 1.5; }
.diag-tags { display: flex; gap: 7px; flex-wrap: wrap; }
.diagnosis-body { padding: 0 22px 20px; display: grid; gap: 16px; }

.diag-block { }
.diag-block-title {
  display: flex; align-items: center; gap: 7px;
  font-size: .78rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-500); margin-bottom: 8px;
}
.diag-text { font-size: .925rem; line-height: 1.75; color: var(--ink-700); }

.evidence-list { display: grid; gap: 8px; }
.evidence-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 13px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); font-size: .885rem; color: var(--ink-700);
}
.evidence-item .ev-no {
  flex: 0 0 20px; height: 20px; display: grid; place-items: center;
  border-radius: 50%; background: var(--red-100); color: var(--red-700);
  font-size: .7rem; font-weight: 700;
}

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare-box { padding: 14px 16px; border-radius: var(--radius); border: 1.5px solid; }
.compare-box.is-wrong { background: var(--red-50); border-color: var(--red-100); }
.compare-box.is-right { background: var(--green-50); border-color: #bbf7d0; }
.compare-label {
  display: flex; align-items: center; gap: 6px;
  font-size: .775rem; font-weight: 700; margin-bottom: 7px;
}
.compare-box.is-wrong .compare-label { color: var(--red-700); }
.compare-box.is-right .compare-label { color: var(--green-700); }
.compare-text { font-size: .9rem; line-height: 1.72; white-space: pre-wrap; word-break: break-word; }
.compare-box.is-wrong .compare-text { color: var(--red-700); }
.compare-box.is-right .compare-text { color: var(--green-700); }

.problem-panel {
  padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.problem-statement {
  font-size: 1.02rem; line-height: 1.85; color: var(--ink-800);
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--ink-50); border-left: 3.5px solid var(--brand-500);
  white-space: pre-wrap; word-break: break-word;
}
.given-list { list-style: none; display: grid; gap: 6px; margin-top: 12px; }
.given-list li { display: flex; gap: 9px; align-items: flex-start; font-size: .89rem; color: var(--ink-600); }
.given-list li::before {
  content: ''; flex: 0 0 6px; width: 6px; height: 6px; margin-top: 8px;
  border-radius: 50%; background: var(--brand-400);
}

/* ============================================================
   交互式讲解
   ============================================================ */

.explain-shell { display: grid; gap: 18px; }

.explain-head {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px; border-radius: var(--radius-lg);
  background: linear-gradient(140deg, var(--brand-700), #4f46e5);
  color: #fff; box-shadow: var(--shadow);
}
.explain-head .eh-ico { font-size: 32px; }
.explain-head h2 { color: #fff; font-size: 1.15rem; margin-bottom: 3px; }
.explain-head p { color: rgba(255,255,255,.85); font-size: .885rem; }

.hook {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 15px 18px; border-radius: var(--radius);
  background: var(--amber-50); border: 1px solid var(--amber-100);
  font-size: .93rem; color: var(--amber-700); line-height: 1.7;
}
.hook .hook-ico { font-size: 20px; flex: 0 0 auto; }

.explain-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.explain-main { display: grid; gap: 16px; min-width: 0; }
.explain-side { display: grid; gap: 16px; position: sticky; top: calc(var(--topbar-h) + 20px); }

/* 进度轨 */
.step-rail { display: flex; align-items: center; gap: 0; padding: 4px 2px; }
.rail-node { display: flex; align-items: center; flex: 1; min-width: 0; }
.rail-dot {
  width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center;
  border-radius: 50%; font-size: .78rem; font-weight: 700;
  background: var(--ink-100); color: var(--ink-400);
  border: 2px solid transparent; transition: all .25s var(--ease);
}
.rail-node.is-active .rail-dot { background: var(--brand-600); color: #fff; box-shadow: 0 0 0 4px var(--brand-100); }
.rail-node.is-visited .rail-dot { background: var(--green-500); color: #fff; }
.rail-bar { flex: 1; height: 2.5px; background: var(--ink-200); margin: 0 3px; border-radius: 99px; }
.rail-node.is-visited .rail-bar { background: var(--green-500); }
.rail-node:last-child { flex: 0 0 auto; }

/* 步骤卡 */
.step-card {
  overflow: hidden; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-xs);
  animation: step-in .3s var(--ease) both;
}
@keyframes step-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.step-header {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 20px; border-bottom: 1px solid var(--line); background: var(--ink-50);
}
.step-no {
  flex: 0 0 30px; height: 30px; display: grid; place-items: center;
  border-radius: 9px; font-size: .84rem; font-weight: 800;
  background: var(--brand-600); color: #fff;
}
.step-header h3 { flex: 1; font-size: 1.02rem; }
.step-body { padding: 20px; display: grid; gap: 16px; }
.step-text { font-size: .965rem; line-height: 1.85; color: var(--ink-700); }
.step-highlight {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 16px; border-radius: var(--radius);
  background: var(--brand-50); border-left: 3.5px solid var(--brand-500);
  font-size: .93rem; font-weight: 600; color: var(--brand-800); line-height: 1.7;
}

.figure-wrap {
  display: grid; gap: 8px; justify-items: center;
  padding: 16px; border-radius: var(--radius);
  background: var(--ink-50); border: 1px solid var(--line);
}
.figure-wrap svg { width: 100%; max-width: 420px; height: auto; display: block; }
.figure-caption { font-size: .82rem; color: var(--ink-500); text-align: center; }

/* 可视化控件 */
.visual { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.visual-title { font-size: .78rem; font-weight: 700; color: var(--ink-500); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }

.viz-numberline { position: relative; padding: 30px 10px 34px; }
.viz-nl-track { position: relative; height: 3px; background: var(--ink-300); border-radius: 99px; margin: 0 14px; }
.viz-nl-tick { position: absolute; top: -7px; width: 2px; height: 17px; background: var(--ink-300); transform: translateX(-50%); }
.viz-nl-label {
  position: absolute; top: 16px; transform: translateX(-50%);
  font-size: .775rem; color: var(--ink-600); white-space: nowrap;
}
.viz-nl-mark {
  position: absolute; top: -20px; transform: translateX(-50%);
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--brand-600); border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(15,23,42,.3);
}
.viz-nl-arrow { position: absolute; top: -27px; transform: translateX(-50%); font-size: 13px; color: var(--brand-600); }

.viz-fraction { display: grid; gap: 9px; }
.viz-frac-bar { display: flex; border: 2px solid var(--ink-400); border-radius: var(--radius-sm); overflow: hidden; height: 46px; }
.viz-frac-cell {
  flex: 1; border-right: 1.5px solid var(--ink-300);
  display: grid; place-items: center; font-size: .78rem; font-weight: 700;
  background: var(--surface); color: var(--ink-400); transition: background .3s var(--ease);
  min-width: 0;
}
.viz-frac-cell:last-child { border-right: 0; }
.viz-frac-cell.is-filled { background: var(--brand-400); color: #fff; }
.viz-frac-cell.is-question { background: repeating-linear-gradient(45deg, var(--amber-100), var(--amber-100) 7px, #fff 7px, #fff 14px); color: var(--amber-700); }
.viz-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-500); }
.viz-legend span { display: flex; align-items: center; gap: 6px; }
.viz-swatch { width: 13px; height: 13px; border-radius: 4px; border: 1px solid var(--ink-300); }

.viz-steps { display: grid; gap: 0; }
.viz-step { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 14px; position: relative; }
.viz-step:not(:last-child)::before {
  content: ''; position: absolute; left: 11px; top: 26px; bottom: 0; width: 2px; background: var(--ink-200);
}
.viz-step-no {
  flex: 0 0 23px; height: 23px; display: grid; place-items: center; z-index: 1;
  border-radius: 50%; background: var(--brand-100); color: var(--brand-700);
  font-size: .72rem; font-weight: 800;
}
.viz-step-text { font-size: .895rem; color: var(--ink-700); padding-top: 1px; }

.viz-equation { display: grid; gap: 9px; }
.viz-eq-line {
  padding: 11px 16px; border-radius: var(--radius); font-size: .96rem;
  font-family: var(--font-mono); background: var(--ink-50);
  border-left: 3px solid var(--brand-400); color: var(--ink-800);
  white-space: pre-wrap; word-break: break-word;
}
.viz-eq-line:last-child { background: var(--green-50); border-left-color: var(--green-500); color: var(--green-700); font-weight: 700; }

.viz-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.viz-table th, .viz-table td { padding: 8px 12px; border: 1px solid var(--line); text-align: left; }
.viz-table th { background: var(--ink-50); font-weight: 700; color: var(--ink-700); }
.viz-table tr:nth-child(even) td { background: var(--ink-50); }

/* 检验题 */
.checkpoint {
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--purple-50); border: 1.5px solid var(--purple-100);
}
.checkpoint-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font-size: .78rem; font-weight: 700; color: var(--purple-600);
  text-transform: uppercase; letter-spacing: .05em;
}
.checkpoint-q { font-size: .955rem; font-weight: 600; color: var(--ink-800); margin-bottom: 13px; line-height: 1.65; }
.options { display: grid; gap: 8px; }
.option {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 15px; border: 1.5px solid var(--ink-200); border-radius: var(--radius);
  background: var(--surface); text-align: left; font-size: .92rem;
  transition: all .15s var(--ease);
}
.option:not(:disabled):hover { border-color: var(--brand-400); background: var(--brand-50); }
.option:disabled { cursor: default; }
.option-key {
  flex: 0 0 24px; height: 24px; display: grid; place-items: center;
  border-radius: 7px; font-size: .78rem; font-weight: 800;
  background: var(--ink-100); color: var(--ink-500);
}
.option-text { flex: 1; }
.option.is-selected { border-color: var(--brand-500); background: var(--brand-50); }
.option.is-selected .option-key { background: var(--brand-600); color: #fff; }
.option.is-correct { border-color: var(--green-500); background: var(--green-50); }
.option.is-correct .option-key { background: var(--green-600); color: #fff; }
.option.is-wrong { border-color: var(--red-500); background: var(--red-50); }
.option.is-wrong .option-key { background: var(--red-600); color: #fff; }

.cp-feedback {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 12px;
  padding: 11px 14px; border-radius: var(--radius); font-size: .885rem; line-height: 1.65;
  animation: step-in .25s var(--ease) both;
}
.cp-feedback.is-correct { background: var(--green-50); color: var(--green-700); border: 1px solid #bbf7d0; }
.cp-feedback.is-wrong { background: var(--red-50); color: var(--red-700); border: 1px solid var(--red-100); }

.step-nav { display: flex; align-items: center; gap: 10px; padding: 15px 20px; border-top: 1px solid var(--line); background: var(--ink-50); }

/* 侧栏知识卡 */
.knowledge-card {
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--brand-200); box-shadow: var(--shadow-sm);
}
.kc-head {
  padding: 14px 18px; background: linear-gradient(135deg, var(--brand-600), #4f46e5); color: #fff;
}
.kc-head h3 { color: #fff; font-size: 1rem; }
.kc-head small { color: rgba(255,255,255,.8); font-size: .78rem; }
.kc-body { padding: 16px 18px; background: var(--surface); display: grid; gap: 14px; }
.kc-formula {
  padding: 13px 16px; border-radius: var(--radius); text-align: center;
  background: var(--brand-50); border: 1px dashed var(--brand-300);
  font-size: .95rem; font-weight: 700; color: var(--brand-800);
  font-family: var(--font-mono); word-break: break-word;
}
.kc-sub { font-size: .755rem; font-weight: 700; color: var(--ink-400); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 7px; }
.kc-tips { list-style: none; display: grid; gap: 8px; }
.kc-tips li { display: flex; gap: 9px; font-size: .875rem; color: var(--ink-600); line-height: 1.65; }
.kc-tips li::before { content: '✓'; flex: 0 0 auto; color: var(--green-600); font-weight: 800; }
.kc-related { display: flex; gap: 6px; flex-wrap: wrap; }

.side-block { padding: 16px 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.side-block h4 { font-size: .9rem; margin-bottom: 11px; display: flex; align-items: center; gap: 7px; }
.plain-list { list-style: none; display: grid; gap: 9px; }
.plain-list li { display: flex; gap: 9px; font-size: .875rem; color: var(--ink-600); line-height: 1.62; }
.plain-list li::before { content: '•'; flex: 0 0 auto; color: var(--amber-500); font-weight: 800; }
.plain-list.is-red li::before { color: var(--red-500); }

/* ============================================================
   练习
   ============================================================ */

.practice-intro {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 18px 22px; border-radius: var(--radius-lg);
  background: linear-gradient(140deg, var(--green-600), #059669); color: #fff;
}
.practice-intro .pi-ico { font-size: 30px; }
.practice-intro h2 { color: #fff; font-size: 1.1rem; margin-bottom: 2px; }
.practice-intro p { color: rgba(255,255,255,.88); font-size: .875rem; }
.pi-score { margin-left: auto; text-align: right; }
.pi-score b { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1; }
.pi-score small { font-size: .76rem; color: rgba(255,255,255,.8); }

.practice-list { display: grid; gap: 16px; }
.practice-card {
  border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-xs); overflow: hidden;
  transition: border-color .2s var(--ease);
}
.practice-card.is-solved { border-color: #bbf7d0; }
.practice-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 15px 20px; border-bottom: 1px solid var(--line); background: var(--ink-50);
}
.practice-head h3 { font-size: 1rem; }
.practice-body { padding: 20px; display: grid; gap: 16px; }
.practice-statement {
  font-size: 1rem; line-height: 1.85; color: var(--ink-800);
  padding: 15px 17px; border-radius: var(--radius);
  background: var(--ink-50); border-left: 3.5px solid var(--brand-500);
  white-space: pre-wrap; word-break: break-word;
}
.practice-goal {
  display: flex; gap: 9px; align-items: flex-start; font-size: .86rem; color: var(--ink-500);
}
.practice-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

.answer-feedback {
  padding: 16px 18px; border-radius: var(--radius); animation: step-in .28s var(--ease) both;
}
.answer-feedback.is-correct { background: var(--green-50); border: 1.5px solid #bbf7d0; }
.answer-feedback.is-wrong { background: var(--red-50); border: 1.5px solid var(--red-100); }
.af-title { display: flex; align-items: center; gap: 9px; font-size: .98rem; font-weight: 700; margin-bottom: 11px; }
.answer-feedback.is-correct .af-title { color: var(--green-700); }
.answer-feedback.is-wrong .af-title { color: var(--red-700); }
.solution-steps { display: grid; gap: 8px; margin-top: 11px; }
.solution-step { display: flex; gap: 10px; align-items: flex-start; font-size: .91rem; line-height: 1.72; }
.solution-step .ss-no {
  flex: 0 0 21px; height: 21px; display: grid; place-items: center; margin-top: 2px;
  border-radius: 6px; font-size: .7rem; font-weight: 800;
  background: rgba(255,255,255,.85); color: var(--ink-600);
}
.answer-feedback.is-correct .solution-step { color: var(--green-700); }
.answer-feedback.is-wrong .solution-step { color: var(--ink-700); }
.answer-text {
  margin-top: 11px; padding: 11px 14px; border-radius: var(--radius);
  background: rgba(255,255,255,.75); font-size: .91rem; color: var(--ink-700);
  white-space: pre-wrap; word-break: break-word;
}

.hint-box {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 15px; border-radius: var(--radius);
  background: var(--amber-50); border: 1px dashed var(--amber-400);
  font-size: .885rem; color: var(--amber-700); animation: step-in .25s var(--ease) both;
}

/* 完成庆祝 */
.celebrate {
  display: flex; gap: 14px; align-items: center;
  padding: 20px 24px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--amber-400), var(--amber-500)); color: #fff;
  box-shadow: var(--shadow);
}
.celebrate .cel-ico { font-size: 38px; }
.celebrate h3 { color: #fff; font-size: 1.1rem; margin-bottom: 2px; }
.celebrate p { color: rgba(255,255,255,.9); font-size: .885rem; }

/* ============================================================
   设置页
   ============================================================ */

.settings-grid { display: grid; gap: 18px; max-width: 780px; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 11px; }
.preset {
  padding: 14px 16px; border: 1.5px solid var(--ink-200); border-radius: var(--radius);
  background: var(--surface); text-align: left; transition: all .16s var(--ease);
}
.preset:hover { border-color: var(--brand-400); background: var(--brand-50); }
.preset.is-active { border-color: var(--brand-600); background: var(--brand-50); box-shadow: 0 0 0 3px var(--brand-100); }
.preset strong { display: block; font-size: .9rem; margin-bottom: 3px; }
.preset small { color: var(--ink-500); font-size: .78rem; line-height: 1.5; display: block; }
.preset code { font-size: .72rem; color: var(--ink-400); font-family: var(--font-mono); word-break: break-all; }

.status-line {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 15px; border-radius: var(--radius); font-size: .885rem; line-height: 1.6;
}
.status-line.is-ok { background: var(--green-50); color: var(--green-700); border: 1px solid #bbf7d0; }
.status-line.is-err { background: var(--red-50); color: var(--red-700); border: 1px solid var(--red-100); }
.status-line.is-info { background: var(--brand-50); color: var(--brand-800); border: 1px solid var(--brand-200); }
.status-line.is-warn { background: var(--amber-50); color: var(--amber-700); border: 1px solid var(--amber-100); }

.usage-list { display: grid; gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; }
.usage-row {
  display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px; align-items: center;
  padding: 10px 14px; background: var(--surface); font-size: .845rem;
}
.usage-row.is-head { background: var(--ink-50); font-weight: 700; color: var(--ink-600); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }

/* ============================================================
   弹窗
   ============================================================ */

.modal-root:empty { display: none; }
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 20px;
  background: rgba(15,23,42,.55); backdrop-filter: blur(3px);
  animation: fade-in .18s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl); animation: modal-in .22s var(--ease);
}
.modal.is-wide { max-width: 720px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px 0; }
.modal-head h2 { flex: 1; font-size: 1.12rem; }
.modal-body { padding: 18px 24px; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 24px 22px; border-top: 1px solid var(--line); margin-top: 4px;
}

/* 图片查看器 */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; padding: 24px;
  background: rgba(8,12,22,.92); animation: fade-in .2s var(--ease);
}
.lightbox img { max-width: 100%; max-height: 86vh; border-radius: var(--radius); box-shadow: var(--shadow-xl); }
.lightbox-close {
  position: absolute; right: 20px; top: 20px; width: 42px; height: 42px;
  display: grid; place-items: center; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff; font-size: 22px;
}
.lightbox-close:hover { background: rgba(255,255,255,.28); }
.lightbox-nav {
  position: absolute; bottom: 26px; display: flex; gap: 9px; align-items: center;
  padding: 7px 14px; border-radius: 99px; background: rgba(255,255,255,.14); color: #fff; font-size: .85rem;
}

/* Toast */
.toast-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 400;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  max-width: 380px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--ink-900); color: #fff; font-size: .885rem; line-height: 1.55;
  box-shadow: var(--shadow-lg); pointer-events: auto;
  animation: toast-in .26s var(--ease); border-left: 3.5px solid var(--ink-500);
}
.toast.is-out { animation: toast-out .22s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }
.toast.is-success { border-left-color: var(--green-500); }
.toast.is-error { border-left-color: var(--red-500); }
.toast.is-info { border-left-color: var(--brand-500); }
.toast.is-warn { border-left-color: var(--amber-500); }
.toast-ico { flex: 0 0 auto; font-size: 1.05rem; }

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 1100px) {
  .explain-layout { grid-template-columns: minmax(0, 1fr); }
  .explain-side { position: static; }
  .upload-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel { min-height: 100vh; }

  .topbar-menu { display: grid; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); z-index: 90;
    transform: translateX(-100%); transition: transform .25s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: none; }
  .layout::after {
    content: ''; position: fixed; inset: var(--topbar-h) 0 0; z-index: 80;
    background: rgba(15,23,42,.4); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease);
  }
  .layout.sidebar-open::after { opacity: 1; pointer-events: auto; }

  .content { padding: 18px 16px 60px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .compare { grid-template-columns: minmax(0, 1fr); }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions { width: 100%; }
  .user-name { display: none; }
  .ai-badge { font-size: .7rem; padding: 3px 8px; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .content { padding: 14px 12px 60px; }
  .card-pad, .card-body, .diagnosis-head, .diagnosis-body { padding-left: 16px; padding-right: 16px; }
  .mistake-card { flex-direction: column; }
  .mistake-thumb { flex: none; width: 100%; height: 150px; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .stat-value { font-size: 1.5rem; }
  .step-nav { flex-wrap: wrap; }
  .step-nav .btn { flex: 1; }
  .toast-wrap { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .toast { max-width: none; }
  .student-switch { display: none; }
  .preview-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .usage-row { grid-template-columns: 1fr auto; row-gap: 2px; }
  .usage-row span:nth-child(3), .usage-row span:nth-child(4) { display: none; }
}

@media print {
  .topbar, .sidebar, .page-actions, .step-nav, .practice-actions, .toast-wrap { display: none !important; }
  .content { padding: 0; }
  .card, .step-card, .practice-card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}

/* ============================================================
   互动课件
   ============================================================ */

/* 课件是全宽阅读页：占满内容区，避免被侧栏挤压导致横向溢出 */
.cw-shell { display: grid; gap: 10px; min-width: 0; }

/* ---------- 紧凑吸顶栏 ---------- */
.cw-head {
  position: sticky; top: var(--topbar-h); z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  background: rgba(255,255,255,.94); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.cw-back {
  flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--ink-600);
  font-size: 19px; line-height: 1; cursor: pointer;
  transition: all .16s var(--ease);
}
.cw-back:hover { background: var(--brand-50); border-color: var(--brand-300); color: var(--brand-700); }
.cw-head-ico { font-size: 18px; flex: 0 0 auto; }
.cw-head-title {
  font-size: .98rem; font-weight: 700; color: var(--ink-900);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 46%;
}
.cw-head-tags { display: flex; gap: 5px; flex-wrap: nowrap; overflow: hidden; }
.cw-head-tags .tag { flex: 0 0 auto; }
.cw-head .cw-progress-text { font-size: .8rem; }
.cw-head .spacer { flex: 1; min-width: 8px; }
.cw-print { flex: 0 0 auto; }

.cw-progress { display: flex; align-items: center; }
.cw-progress .bar { flex: 1; height: 4px; }
.cw-progress-text { font-size: .78rem; font-weight: 600; color: var(--ink-500); white-space: nowrap; }

/* ---------- 进度点（紧凑：只有圆点，标签进 title） ---------- */
.cw-rail {
  display: flex; align-items: center; gap: 0;
  overflow-x: auto; padding: 2px 2px 4px;
  scrollbar-width: none;
}
.cw-rail::-webkit-scrollbar { display: none; }
.cw-dot { flex: 0 0 auto; border: 0; background: none; padding: 3px 2px; cursor: pointer; }
.cw-dot-num {
  display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: .7rem; font-weight: 700;
  background: var(--ink-100); color: var(--ink-400);
  border: 2px solid transparent;
  transition: all .2s var(--ease);
}
.cw-dot:hover .cw-dot-num { background: var(--brand-100); color: var(--brand-700); }
.cw-dot.is-active .cw-dot-num { background: var(--brand-600); color: #fff; box-shadow: 0 0 0 3px var(--brand-100); }
.cw-dot.is-visited .cw-dot-num { background: var(--brand-200); color: var(--brand-800); }
.cw-dot.is-solved .cw-dot-num { background: var(--green-500); color: #fff; }
.cw-dot-line { flex: 1 0 8px; height: 2px; background: var(--ink-200); border-radius: 99px; min-width: 6px; }
.cw-dot-line.is-visited { background: var(--green-400); }

/* ---------- 布局：正文优先，侧栏在宽屏才出现 ---------- */
.cw-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 232px;
  gap: 14px; align-items: start; min-width: 0;
}
.cw-stage { min-width: 0; }

/* 侧栏必须锁死宽度：
   grid 列虽写成 232px，但列内的长文本（如很长的小节标题）会产生很大的
   min-content 宽度，把整列连同页面一起撑宽，导致横向滚动。
   这里把每一层都设 min-width:0 并裁掉溢出。 */
.cw-aside {
  display: grid; gap: 12px;
  position: sticky; top: calc(var(--topbar-h) + 56px);
  width: 232px; min-width: 0;
}
.cw-aside > * { min-width: 0; max-width: 100%; overflow: hidden; }

/* 中等宽度：收起侧栏，只保留正文（避免挤压与横向溢出） */
@media (max-width: 1180px) {
  .cw-layout { grid-template-columns: minmax(0, 1fr); }
  .cw-aside { display: none; }
}
/* 幻灯片卡片 */
.cw-card {
  border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  overflow: hidden; animation: cw-in .28s var(--ease) both;
}
@keyframes cw-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.cw-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--ink-50);
}
.cw-kind-ico { font-size: 20px; }
.cw-block-title { padding: 15px 22px 0; font-size: 1.12rem; }
.cw-body { padding: 16px 22px 18px; display: grid; gap: 13px; }

.cw-text { font-size: .965rem; line-height: 1.85; color: var(--ink-700); white-space: pre-wrap; }

.cw-hook {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--amber-50); border: 1px solid var(--amber-100);
  font-size: .96rem; color: var(--amber-700); line-height: 1.75;
}
.cw-hook-ico { font-size: 22px; flex: 0 0 auto; }

.cw-analogy {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 15px; border-radius: var(--radius);
  background: var(--purple-50); border: 1px dashed var(--purple-100);
  font-size: .91rem; color: var(--purple-600); line-height: 1.7;
}

.cw-section { display: grid; gap: 9px; }
.cw-takeaway {
  padding: 13px 15px; border-radius: var(--radius);
  background: var(--brand-50); border-left: 3.5px solid var(--brand-500);
}
.cw-takeaway .cw-bullet { background: rgba(255,255,255,.8); border-color: transparent; padding: 9px 12px; }
.cw-section-title {
  display: flex; align-items: center; gap: 7px;
  font-size: .78rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-500);
}
.cw-objectives { list-style: none; display: grid; gap: 9px; }
.cw-objectives li {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: .93rem; color: var(--ink-700); line-height: 1.7;
}
.cw-objectives li::before {
  content: '✓'; flex: 0 0 20px; height: 20px; margin-top: 2px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--green-100); color: var(--green-700);
  font-size: .7rem; font-weight: 800;
}
.cw-bullets { display: grid; gap: 9px; }
.cw-bullet {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--radius);
  background: var(--ink-50); border: 1px solid var(--line);
  font-size: .92rem; color: var(--ink-700); line-height: 1.7;
}
.cw-bullet-no {
  flex: 0 0 21px; height: 21px; display: grid; place-items: center; margin-top: 1px;
  border-radius: 6px; background: var(--brand-600); color: #fff;
  font-size: .7rem; font-weight: 800;
}

.cw-geometry-note {
  padding: 16px; border-radius: var(--radius); text-align: center;
  background: var(--brand-50); border: 1px dashed var(--brand-200);
  font-size: .92rem; color: var(--brand-800);
}

/* 检验题 */
.cw-quiz {
  padding: 18px; border-radius: var(--radius-lg);
  background: var(--purple-50); border: 1.5px solid var(--purple-100);
  display: grid; gap: 13px;
}
.cw-quiz-head {
  display: flex; align-items: center; gap: 8px;
  font-size: .78rem; font-weight: 700; color: var(--purple-600);
  text-transform: uppercase; letter-spacing: .05em;
}
.cw-quiz-q { font-size: .985rem; font-weight: 600; color: var(--ink-800); line-height: 1.7; }
.cw-fill-row { display: flex; gap: 10px; }
.cw-fill-row .input { flex: 1; }

/* 导航条 */
.cw-nav {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding: 14px 18px;
  border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-xs);
}

/* 封面 */
.cw-cover { text-align: center; padding: 38px 26px; display: grid; gap: 16px; justify-items: center; }
.cw-cover-ico { font-size: 56px; line-height: 1; }
.cw-cover h2 { font-size: 1.5rem; max-width: 620px; }
.cw-cover-tags { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }
.cw-cover-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 12px; width: 100%; max-width: 620px; margin-top: 6px;
}
.cw-meta-item {
  padding: 12px 10px; border-radius: var(--radius);
  background: var(--ink-50); border: 1px solid var(--line);
}
.cw-meta-item small { display: block; font-size: .72rem; color: var(--ink-400); margin-bottom: 3px; }
.cw-meta-item strong { font-size: .95rem; color: var(--ink-800); }
.cw-cover-hint {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  max-width: 560px; padding: 13px 16px; border-radius: var(--radius);
  background: var(--brand-50); border: 1px solid var(--brand-200);
  font-size: .89rem; color: var(--brand-800); line-height: 1.7;
}

/* 大纲 */
.cw-outline { display: grid; gap: 2px; }
.cw-outline-item {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0;
  padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; text-align: left; font-size: .875rem;
  color: var(--ink-600); transition: background .15s var(--ease);
}
.cw-outline-item:hover { background: var(--ink-100); }
.cw-outline-item.is-active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.cw-outline-item.is-solved .cw-outline-mark { color: var(--green-600); font-weight: 800; }
.cw-outline-ico { flex: 0 0 auto; font-size: .95rem; }
.cw-outline-text { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-outline-mark { flex: 0 0 auto; color: var(--ink-300); font-size: .85rem; }

.cw-summary-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.cw-mindmap { display: grid; gap: 7px; }
.cw-mindmap-item {
  padding: 9px 14px; border-radius: var(--radius);
  background: var(--brand-50); border-left: 3px solid var(--brand-500);
  font-size: .9rem; color: var(--brand-800);
}

.cw-list-card { transition: all .18s var(--ease); }
.cw-list-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--brand-200); }

@media (max-width: 640px) {
  .cw-body, .cw-block-title { padding-left: 16px; padding-right: 16px; }
  .cw-cover { padding: 26px 16px; }
  .cw-fill-row { flex-direction: column; }
  .cw-nav .btn { flex: 1; }
  .cw-dot-label { display: none; }
}
@media print {
  .cw-nav, .cw-aside, .cw-head-actions, .cw-rail, .cw-progress { display: none !important; }
  .cw-card { break-inside: avoid; box-shadow: none; }
}

/* ============================================================
   交互插图
   ============================================================ */

.visual-interactive { background: linear-gradient(180deg, #fbfdff, var(--surface)); }

.fig { display: grid; gap: 12px; user-select: none; -webkit-user-select: none; }

.fig-hint {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 9px 13px; border-radius: var(--radius);
  background: var(--brand-50); border: 1px dashed var(--brand-200);
  font-size: .855rem; color: var(--brand-800); line-height: 1.6;
}

.fig-readout {
  padding: 10px 14px; border-radius: var(--radius); text-align: center;
  background: var(--ink-100); color: var(--ink-600);
  font-size: .92rem; font-weight: 700;
  transition: all .22s var(--ease);
}
.fig-readout.is-active {
  background: var(--green-50); color: var(--green-700);
  border: 1px solid #bbf7d0;
}

.fig-feedback {
  padding: 11px 14px; border-radius: var(--radius);
  font-size: .89rem; line-height: 1.65; animation: step-in .25s var(--ease) both;
}
.fig-feedback.is-ok { background: var(--green-50); color: var(--green-700); border: 1px solid #bbf7d0; }
.fig-feedback.is-no { background: var(--amber-50); color: var(--amber-700); border: 1px solid var(--amber-100); }

.fig-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- 点选份数条 ---------- */
.fig-frac-bar {
  display: flex; gap: 4px; padding: 6px;
  border-radius: var(--radius); background: var(--ink-50);
  border: 2px solid var(--ink-200);
}
.fig-frac-cell {
  flex: 1; min-width: 0; height: 62px; min-height: 44px;
  display: grid; place-items: center; position: relative;
  border: 2px dashed var(--ink-300); border-radius: 10px;
  background: var(--surface); cursor: pointer;
  font-size: .82rem; font-weight: 800; color: var(--ink-300);
  transition: all .18s var(--ease);
}
.fig-frac-cell:hover { border-color: var(--brand-400); background: var(--brand-50); transform: translateY(-2px); }
.fig-frac-cell:active { transform: scale(.96); }
.fig-frac-cell.is-on {
  background: linear-gradient(160deg, var(--brand-400), var(--brand-600));
  border: 2px solid var(--brand-700); color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
  animation: fig-pop .3s var(--ease);
}
.fig-frac-cell.is-on .fig-frac-num { color: #fff; opacity: .85; }
.fig-frac-num { position: absolute; bottom: 3px; font-size: .62rem; font-weight: 700; }
@keyframes fig-pop { 0% { transform: scale(.9) translateY(0); } 60% { transform: scale(1.06) translateY(-3px); } 100% { transform: scale(1) translateY(-2px); } }

/* ---------- 拖动数轴 ---------- */
.fig-nl-wrap { padding: 34px 18px 30px; }
.fig-nl-track {
  position: relative; height: 6px; border-radius: 99px;
  background: linear-gradient(90deg, var(--brand-200), var(--brand-400), var(--brand-200));
  margin: 0 20px; cursor: pointer;
}
.fig-nl-tick {
  position: absolute; top: -9px; width: 2px; height: 24px;
  background: var(--ink-300); transform: translateX(-50%);
}
.fig-nl-label {
  position: absolute; top: 18px; transform: translateX(-50%);
  font-size: .78rem; font-weight: 600; color: var(--ink-600); white-space: nowrap;
}
.fig-nl-marker {
  position: absolute; top: -26px; transform: translateX(-50%);
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: grab;
  background: var(--amber-400); font-size: 22px; line-height: 1;
  box-shadow: 0 4px 14px rgba(245, 158, 11, .45);
  transition: left .16s var(--ease), transform .16s var(--ease);
  touch-action: none;
}
.fig-nl-marker:hover { transform: translateX(-50%) scale(1.08); }
.fig-nl-marker.is-dragging { cursor: grabbing; transform: translateX(-50%) scale(1.16); transition: none; }

/* ---------- 平衡天平 ---------- */
.fig-balance-scene {
  position: relative; display: grid; grid-template-columns: 1fr 84px 1fr;
  align-items: end; gap: 4px; padding: 8px 4px 0; min-height: 150px;
}
.fig-balance-pan-wrap { display: grid; gap: 4px; justify-items: center; align-content: end; }
.fig-balance-pan {
  display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; align-items: flex-end;
  min-height: 42px; padding: 7px 9px; min-width: 84px;
  border: 2.5px solid var(--ink-400); border-top: 0;
  border-radius: 0 0 30px 30px; background: var(--ink-50);
}
.fig-weight { font-size: 17px; line-height: 1; animation: fig-pop .3s var(--ease); }
.fig-balance-rope { width: 2px; height: 16px; background: var(--ink-400); }
.fig-balance-pivot { display: grid; justify-items: center; align-content: end; }
.fig-balance-beam {
  width: 100%; height: 7px; border-radius: 99px;
  background: linear-gradient(90deg, var(--ink-500), var(--ink-400), var(--ink-500));
  transition: transform .35s var(--ease);
  transform-origin: center center;
}
.fig-balance-beam.is-balanced { background: linear-gradient(90deg, var(--green-500), #34d399, var(--green-500)); }
.fig-balance-stand {
  width: 0; height: 0; margin-top: 2px;
  border-left: 16px solid transparent; border-right: 16px solid transparent;
  border-bottom: 40px solid var(--ink-400);
}
.fig-balance-controls { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.fig-balance-ctrl {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 9px; border-radius: 99px;
  background: var(--ink-50); border: 1px solid var(--line);
}
.fig-balance-count { font-size: .82rem; font-weight: 700; color: var(--ink-600); min-width: 18px; text-align: center; }

/* ---------- 互动饼图 ---------- */
.fig-pie-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; justify-content: center; }
.fig-pie-svg { width: 168px; height: 168px; flex: 0 0 auto; }
.fig-pie-slice {
  cursor: pointer; transition: transform .2s var(--ease), filter .2s var(--ease);
  transform-origin: 80px 80px;
}
.fig-pie-slice:hover { filter: brightness(1.1); transform: scale(1.05); }
.fig-pie-slice.is-on { transform: scale(1.08); filter: brightness(1.12) drop-shadow(0 3px 6px rgba(15,23,42,.2)); }
.fig-pie-legend { display: grid; gap: 6px; }
.fig-pie-legend-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border: 1.5px solid var(--line); border-radius: 99px;
  background: var(--surface); font-size: .85rem; cursor: pointer;
  transition: all .16s var(--ease);
}
.fig-pie-legend-item:hover { border-color: var(--brand-400); background: var(--brand-50); }
.fig-pie-dot { width: 12px; height: 12px; border-radius: 4px; flex: 0 0 auto; }

/* ---------- 逐步揭晓 ---------- */
.fig-reveal-list { display: grid; gap: 8px; }
.fig-reveal-item {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 15px; border-radius: var(--radius);
  background: var(--ink-50); border: 1.5px dashed var(--ink-200);
  font-size: .92rem; color: var(--ink-400); line-height: 1.7;
  transition: all .28s var(--ease);
}
.fig-reveal-item.is-next { border-color: var(--brand-400); background: var(--brand-50); color: var(--brand-700); }
.fig-reveal-item.is-shown {
  border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink-700); animation: step-in .3s var(--ease) both;
}
.fig-reveal-no {
  flex: 0 0 22px; height: 22px; display: grid; place-items: center; margin-top: 1px;
  border-radius: 50%; background: var(--ink-200); color: var(--ink-500);
  font-size: .72rem; font-weight: 800;
}
.fig-reveal-item.is-shown .fig-reveal-no { background: var(--brand-600); color: #fff; }
.fig-reveal-item.is-next .fig-reveal-no { background: var(--brand-400); color: #fff; }
.fig-reveal-count { font-size: .8rem; font-weight: 700; color: var(--ink-500); margin-left: auto; }

/* ---------- 可操作表格 ---------- */
.fig-table-wrap { overflow-x: auto; }
.fig-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.fig-table th, .fig-table td { padding: 9px 12px; border: 1px solid var(--line); text-align: left; }
.fig-table th { background: var(--ink-50); font-weight: 700; color: var(--ink-700); }
.fig-table-row { cursor: pointer; transition: background .15s var(--ease); }
.fig-table-row:hover { background: var(--brand-50); }
.fig-table-row.is-hidden td:last-child {
  color: var(--brand-600); font-weight: 700;
  background: repeating-linear-gradient(45deg, var(--brand-50), var(--brand-50) 6px, #fff 6px, #fff 12px);
}

/* ---------- 简笔 SVG 图形动效 ---------- */
.fig-svg-inner { display: grid; justify-items: center; }
.fig-svg-inner svg { width: 100%; max-width: 400px; height: auto; }
.fig-svg-animated path, .fig-svg-animated line, .fig-svg-animated circle,
.fig-svg-animated rect, .fig-svg-animated polygon, .fig-svg-animated ellipse {
  animation: fig-draw .5s var(--ease) both;
}
@keyframes fig-draw { from { opacity: 0; } to { opacity: 1; } }
.fig-caption { font-size: .82rem; color: var(--ink-500); text-align: center; }

@media (max-width: 640px) {
  .fig-frac-cell { height: 52px; }
  .fig-pie-svg { width: 140px; height: 140px; }
  .fig-balance-scene { grid-template-columns: 1fr 60px 1fr; }
  .fig-nl-marker { width: 40px; height: 40px; font-size: 20px; }
  .fig-nl-wrap { padding: 30px 10px 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .fig *, .fig-svg-animated * { animation: none !important; transition: none !important; }
}

/* ============================================================
   Canvas 仿真（参数可调 + 动画 + 实时数据）
   ============================================================ */

.sim {
  display: grid; gap: 10px;
  padding: 14px; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #f8fbff, var(--surface));
  border: 1px solid var(--brand-200);
  box-shadow: 0 1px 3px rgba(37, 99, 235, .06);
}
.sim-title {
  display: flex; align-items: center; gap: 7px;
  font-size: .88rem; font-weight: 700; color: var(--brand-800);
}
.sim-title-ico { font-size: 15px; }

.sim-stage {
  border-radius: var(--radius); overflow: hidden;
  background: #fff; border: 1px solid var(--line);
}
.sim-canvas { display: block; width: 100%; height: auto; }

.sim-controls { display: grid; gap: 10px; }

.sim-sliders {
  display: flex; gap: 16px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--ink-50); border: 1px solid var(--line);
}
.sim-slider { display: flex; align-items: center; gap: 9px; min-width: 210px; flex: 1; }
.sim-slider-label { font-size: .82rem; font-weight: 600; color: var(--ink-600); white-space: nowrap; }
.sim-slider-value {
  font-size: .8rem; font-weight: 700; color: var(--brand-700);
  min-width: 52px; text-align: right; font-variant-numeric: tabular-nums;
}

.sim-range {
  flex: 1; height: 5px; min-width: 80px;
  -webkit-appearance: none; appearance: none;
  background: var(--ink-200); border-radius: 99px; outline: none; cursor: pointer;
}
.sim-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--brand-600); border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, .4);
  cursor: grab; transition: transform .12s var(--ease);
}
.sim-range::-webkit-slider-thumb:active { transform: scale(1.15); cursor: grabbing; }
.sim-range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--brand-600); border: 2.5px solid #fff; cursor: grab;
}

.sim-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sim-play.is-running { background: var(--amber-500); }
.sim-play.is-running:hover { background: var(--amber-600); }

.sim-readouts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.sim-readout {
  display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap;
  padding: 9px 12px; background: var(--surface);
}
.sim-readout-label { font-size: .74rem; color: var(--ink-500); width: 100%; }
.sim-readout-value {
  font-size: 1.05rem; font-weight: 800; color: var(--brand-700);
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.sim-readout-unit { font-size: .72rem; color: var(--ink-400); }

.sim-observe {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--radius);
  background: var(--amber-50); border: 1px dashed var(--amber-400);
  font-size: .875rem; color: var(--amber-700); line-height: 1.7;
}

@media (max-width: 640px) {
  .sim { padding: 11px; }
  .sim-slider { min-width: 100%; }
  .sim-readouts { grid-template-columns: repeat(2, 1fr); }
  .sim-actions .btn { flex: 1; }
}

/* ============================================================
   登录/注册：手机号 + 验证码
   ============================================================ */

/* 验证码输入框与「获取验证码」按钮同一行 */
.code-row { display: flex; gap: 8px; align-items: stretch; }
.code-row input { flex: 1; min-width: 0; }
.code-btn {
  flex: 0 0 auto; white-space: nowrap;
  min-width: 108px; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.code-btn:disabled { opacity: .6; cursor: not-allowed; }

/* 老账号邮箱登录：默认折叠，不干扰手机号主流程 */
.auth-more {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.auth-more summary {
  cursor: pointer; font-size: .86rem; color: var(--ink-500);
  list-style: none; user-select: none;
}
.auth-more summary::-webkit-details-marker { display: none; }
.auth-more summary::before { content: '▸ '; }
.auth-more[open] summary::before { content: '▾ '; }
.auth-more summary:hover { color: var(--brand-600); }
.auth-more .field { margin-top: 10px; }
.form-hint { font-size: .78rem; color: var(--ink-400); margin-top: 8px; line-height: 1.6; }

@media (max-width: 480px) {
  .code-row { flex-wrap: wrap; }
  .code-btn { width: 100%; min-width: 0; }
}

/* ============================================================
   手机端顶栏修正
   ------------------------------------------------------------
   390px 宽时，品牌名 + AI 状态胶囊 + 用户按钮挤在一行，
   品牌文字被压到 39px 宽 → 中文按字换行，显示成竖排的「错题本」。
   处理：文字不换行、状态胶囊在窄屏收起（家长也不需要看模型名）。
   ============================================================ */
.topbar-brand { flex: 0 0 auto; white-space: nowrap; }
.topbar-brand > span:last-child { white-space: nowrap; }
.topbar-actions { flex: 0 1 auto; min-width: 0; }

@media (max-width: 560px) {
  /* AI 状态胶囊在窄屏收起：它是管理员关心的信息，家长不需要 */
  .topbar .ai-badge { display: none; }
  .topbar-brand { font-size: 1rem; gap: 6px; }
  .brand-mark-sm { font-size: 19px; }
  .topbar { padding: 0 10px; gap: 6px; }
}

/* ============================================================
   家长端手机版：底部 tab 导航
   ------------------------------------------------------------
   手机上侧栏要展开才能点，不顺手；底部 tab 是移动端惯用形态，
   拇指够得到。桌面端完全不显示（侧栏已足够）。
   ============================================================ */

.tabbar { display: none; }

@media (max-width: 900px) {
  .tabbar {
    display: grid;
    grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    /* 适配 iPhone 底部横条 */
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -2px 12px rgba(15,23,42,.06);
  }
  .tab-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 7px 2px 6px;
    /* 触摸目标 ≥44px，符合移动端可用性下限 */
    min-height: 52px;
    color: var(--ink-400); text-decoration: none !important;
    font-size: .68rem; font-weight: 600;
    -webkit-tap-highlight-color: transparent;
    transition: color .15s var(--ease);
    position: relative;
  }
  .tab-ico { font-size: 21px; line-height: 1; filter: grayscale(1) opacity(.55); transition: filter .15s var(--ease); }
  .tab-item.is-active { color: var(--brand-600); }
  .tab-item.is-active .tab-ico { filter: none; }
  .tab-item.is-active::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand-600);
  }
  .tab-text { white-space: nowrap; }

  /* 底部给 tab 让位，避免内容被遮住 */
  .content { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0)) !important; }
  /* 手机上不再需要汉堡菜单（tab 已覆盖主入口），保留以访问学生管理/设置 */
  .sidebar { top: 0; height: 100vh; padding-top: 12px; }
}

/* ---------- 「我的」页 ---------- */
.me-card { display: flex; align-items: center; gap: 14px; padding: 18px 16px; }
.me-avatar {
  flex: 0 0 auto; width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand-600), #4f46e5);
  color: #fff; font-size: 1.4rem; font-weight: 800;
}
.me-info { min-width: 0; }
.me-name { font-size: 1.1rem; font-weight: 800; color: var(--ink-900); }
.me-sub { font-size: .84rem; color: var(--ink-500); margin-top: 2px; word-break: break-all; }

.me-students { display: grid; gap: 9px; }
.me-student {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 56px;
  padding: 10px 13px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  text-align: left; cursor: pointer; transition: all .15s var(--ease);
}
.me-student:active { transform: scale(.985); }
.me-student.is-active { border-color: var(--brand-400); background: var(--brand-50); }
.me-student-ico { font-size: 24px; flex: 0 0 auto; }
.me-student-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.me-student-text strong { font-size: .95rem; color: var(--ink-900); }
.me-student-text small { font-size: .76rem; color: var(--ink-400); }
.me-student-check { color: var(--brand-600); font-weight: 800; font-size: 1.05rem; }

.menu-list { display: grid; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px;
  padding: 12px 16px; background: none; border: 0; border-bottom: 1px solid var(--line);
  text-align: left; cursor: pointer; transition: background .15s var(--ease);
}
.menu-item:last-child { border-bottom: 0; }
.menu-item:active { background: var(--ink-50); }
.menu-ico { font-size: 20px; flex: 0 0 auto; }
.menu-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.menu-text strong { font-size: .93rem; color: var(--ink-800); font-weight: 600; }
.menu-text small { font-size: .75rem; color: var(--ink-400); }
.menu-arrow { color: var(--ink-300); font-size: 1.3rem; }
.me-logout { color: var(--red-600); }

/* ============================================================
   知识缺口地图
   ============================================================ */

.gap-overview {
  display: grid; gap: 10px; margin-bottom: 14px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.gap-card {
  padding: 13px 15px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line);
}
.gap-card-label { font-size: .8rem; font-weight: 700; color: var(--ink-600); }
.gap-card-value { font-size: 1.7rem; font-weight: 800; line-height: 1.2; margin: 2px 0; }
.gap-card-hint { font-size: .74rem; color: var(--ink-400); }

.gap-card.is-red    { background: var(--red-50);    border-color: var(--red-100); }
.gap-card.is-red    .gap-card-value { color: var(--red-600); }
.gap-card.is-amber  { background: var(--amber-50);  border-color: var(--amber-100); }
.gap-card.is-amber  .gap-card-value { color: var(--amber-600); }
.gap-card.is-green  { background: var(--green-50);  border-color: var(--green-100); }
.gap-card.is-green  .gap-card-value { color: var(--green-600); }
.gap-card.is-plain  .gap-card-value { color: var(--ink-800); }

/* ---------- 优先补 ---------- */
.gap-priorities { display: grid; gap: 10px; }
.gap-priority {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--red-50); border: 1px solid var(--red-100);
}
.gap-priority-no {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--red-500); color: #fff; font-size: .82rem; font-weight: 800;
}
.gap-priority-main { flex: 1; min-width: 0; }
.gap-priority-name {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: .95rem; font-weight: 700; color: var(--ink-900);
}
.gap-priority-meta { font-size: .78rem; color: var(--ink-500); margin-top: 3px; }
.gap-none { font-size: .9rem; color: var(--green-600); font-weight: 600; }

/* ---------- 学科分组 ---------- */
.gap-subject { margin-bottom: 18px; }
.gap-subject:last-child { margin-bottom: 0; }
.gap-subject-head {
  display: flex; align-items: baseline; gap: 9px; margin-bottom: 9px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.gap-subject-head strong { font-size: .95rem; }

.gap-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.gap-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  min-height: 60px; padding: 10px 12px;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); text-align: left; cursor: pointer;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.gap-tile:active { transform: scale(.98); }
.gap-tile:hover { box-shadow: var(--shadow-sm, 0 2px 8px rgba(15,23,42,.08)); }
.gap-tile-name {
  font-size: .86rem; font-weight: 600; color: var(--ink-800); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gap-tile-badge {
  font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 99px;
}
.gap-tile.is-red   { background: var(--red-50);   border-color: var(--red-100); }
.gap-tile.is-red   .gap-tile-badge { background: var(--red-500); color: #fff; }
.gap-tile.is-amber { background: var(--amber-50); border-color: var(--amber-100); }
.gap-tile.is-amber .gap-tile-badge { background: var(--amber-400); color: #fff; }
.gap-tile.is-green { background: var(--green-50); border-color: var(--green-100); }
.gap-tile.is-green .gap-tile-badge { background: var(--green-500); color: #fff; }

/* ---------- 图例 ---------- */
.gap-legend { display: grid; gap: 10px; }
.gap-legend-item { display: flex; gap: 10px; align-items: flex-start; }
.gap-dot { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; }
.gap-dot.is-red { background: var(--red-500); }
.gap-dot.is-amber { background: var(--amber-400); }
.gap-dot.is-green { background: var(--green-500); }

/* ---------- 明细弹层 ---------- */
.gap-detail { display: grid; gap: 8px; }
.gap-detail-row { display: flex; gap: 12px; font-size: .88rem; }
.gap-detail-key { flex: 0 0 84px; color: var(--ink-500); }
.gap-detail-val { flex: 1; color: var(--ink-800); }

@media (max-width: 640px) {
  .gap-overview { grid-template-columns: repeat(2, 1fr); }
  .gap-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .gap-priority { flex-wrap: wrap; }
  .gap-priority .btn { width: 100%; }
}

/* ============================================================
   登录页页脚：运营主体与 ICP 备案号
   ------------------------------------------------------------
   合规要求：网站需公示 ICP 备案号与运营主体。
   微信支付审核 H5 域名时也会核对这两项，所以放在首屏可见位置。
   ============================================================ */
.hero-meta {
  margin: 16px 0 0; font-size: .82rem; color: var(--ink-400);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.hero-meta a { color: var(--brand-500, var(--brand-600)); text-decoration: none; font-weight: 600; }
.hero-meta a:hover { text-decoration: underline; }
.hero-meta span { color: var(--ink-300); }
.hero-icp { margin: 6px 0 0; font-size: .78rem; }
.hero-icp a { color: var(--ink-400); text-decoration: none; }
.hero-icp a:hover { color: var(--ink-600); text-decoration: underline; }
