﻿/* 数学教学工作台 · 样式 */

:root {
  --bg: #0a0e17;
  --bg2: #0d1320;
  --panel: #111a2a;
  --panel2: #172033;
  --line: #223049;
  --text: #e9eefb;
  --muted: #8b99b7;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, 0.14);
  --ok: #2ecc9b;
  --ok-soft: rgba(46, 204, 155, 0.13);
  --warn: #ffb454;
  --warn-soft: rgba(255, 180, 84, 0.13);
  --bad: #ff6b76;
  --bad-soft: rgba(255, 107, 118, 0.13);
  --radius: 14px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

html[data-theme="light"] {
  --bg: #f3f6fc;
  --bg2: #eef2f9;
  --panel: #ffffff;
  --panel2: #f4f7fd;
  --line: #e1e8f4;
  --text: #131a29;
  --muted: #66748f;
  --accent: #3b6fe8;
  --accent-soft: rgba(59, 111, 232, 0.1);
  --ok: #10a075;
  --ok-soft: rgba(16, 160, 117, 0.1);
  --warn: #b56f06;
  --warn-soft: rgba(181, 111, 6, 0.12);
  --bad: #d63b47;
  --bad-soft: rgba(214, 59, 71, 0.09);
  --shadow: 0 18px 40px rgba(23, 38, 64, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(91, 140, 255, 0.14), transparent 60%),
    var(--bg);
  font: 14px/1.6 "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
html[data-theme="light"] body { background: var(--bg); }
body.modal-open { overflow: hidden; }

h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 20px; font-weight: 700; letter-spacing: 0.2px; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 14.5px; font-weight: 650; }
h4 { font-size: 12.5px; font-weight: 650; color: var(--muted); margin: 14px 0 7px; letter-spacing: 0.3px; }
h4:first-child { margin-top: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--panel2);
  border: 1px solid var(--line);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
}
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 通用控件 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.16s;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.primary {
  background: linear-gradient(135deg, #5b8cff, #4a77f0);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(74, 119, 240, 0.28);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel2); color: var(--text); }
.btn.sm { padding: 6px 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }

.link {
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 6px;
}
.link:hover { background: var(--accent-soft); }
.link.danger { color: var(--bad); }
.link.danger:hover { background: var(--bad-soft); }

.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.icon-btn:hover { background: var(--panel2); color: var(--text); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.grow { flex: 1; }

.input {
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  min-width: 180px;
  transition: 0.16s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.mini { min-width: 0; width: auto; cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: 0.16s;
}
.field textarea { resize: vertical; line-height: 1.65; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field-row .field { margin-bottom: 12px; }
.inline-input { display: flex; gap: 8px; }
.inline-input input { flex: 1; }

.check-row { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; margin-bottom: 14px; line-height: 1.6; }
.check-row input { margin-top: 3px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.btn-row.center { justify-content: center; margin-top: 18px; }

.sep { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.pad { padding: 16px; }

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

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  padding: 26px 26px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #5b8cff, #8f6bff 60%, #2ecc9b);
  box-shadow: 0 8px 20px rgba(91, 140, 255, 0.35);
}
.logo.sm { width: 34px; height: 34px; flex-basis: 34px; font-size: 17px; border-radius: 10px; }
.login-brand h1 { font-size: 18px; }
.login-brand p { font-size: 12px; color: var(--muted); margin-top: 2px; }

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 11px; background: var(--panel2); margin-bottom: 18px; }
.tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.tab.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18); }
.login-tip { margin-top: 14px; font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.6; }

/* ---------------- 应用框架 ---------------- */

.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg2) 82%, transparent);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-txt strong { display: block; font-size: 13.5px; letter-spacing: 0.3px; }
.brand-txt span { display: block; font-size: 11.5px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: 0.16s;
}
.nav-item svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 17px; }
.nav-item:hover { background: var(--panel2); color: var(--text); }
.nav-item[aria-current="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
  font-weight: 600;
}
.cnt {
  margin-left: auto;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--panel2);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.nav-item[aria-current="true"] .cnt { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.cnt.warn { color: var(--warn); background: var(--warn-soft); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px);
}
.topbar h2 { font-size: 16px; }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.view { padding: 22px 28px 70px; max-width: 1220px; width: 100%; }

.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ---------------- 面板 / 列表 / 统计 ---------------- */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  overflow: hidden;
}
.panel + .panel { margin-top: 16px; }
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 13.5px; }
.panel-head .link { margin-left: auto; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-bottom: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  position: relative;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  overflow: hidden;
}
.stat .label { font-size: 12px; color: var(--muted); }
.stat strong { display: block; font-size: 25px; font-weight: 750; line-height: 1.3; letter-spacing: -0.5px; }
.stat strong small { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat .foot { font-size: 11.5px; color: var(--muted); }
.stat.alert { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: linear-gradient(180deg, var(--warn-soft), transparent 70%); }
.stat.alert strong { color: var(--warn); }

.bar { height: 5px; border-radius: 99px; background: var(--panel2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #5b8cff, #2ecc9b); transition: width 0.4s; }

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 16px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: color-mix(in srgb, var(--panel2) 70%, transparent); }
.lr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lr-main strong { font-size: 13px; font-weight: 600; }
.lr-main .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.problem-row { cursor: default; }
.problem-row .idx {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--panel2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel2);
  font-size: 11px;
  line-height: 18px;
  color: var(--muted);
  white-space: nowrap;
  flex: 0 0 auto;
}
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); background: var(--ok-soft); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); background: var(--warn-soft); }
.chip.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: var(--bad-soft); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }

.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.empty .ico { font-size: 26px; margin-bottom: 8px; opacity: 0.85; }
.empty h3 { font-size: 13.5px; color: var(--text); margin-bottom: 4px; }
.empty p { font-size: 12.5px; max-width: 380px; margin: 0 auto 12px; line-height: 1.7; }

/* ---------------- 工具栏 / 表格 ---------------- */

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); gap: 2px; flex-wrap: wrap; }
.seg button {
  padding: 5px 11px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel); color: var(--accent); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16); }

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th, .tbl td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: 11.5px; font-weight: 600; color: var(--muted); background: color-mix(in srgb, var(--panel2) 60%, transparent); white-space: nowrap; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--panel2) 55%, transparent); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl.compact th, .tbl.compact td { padding: 8px 12px; }
.td-statement { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-actions { white-space: nowrap; text-align: right; }
.stars { color: var(--warn); font-size: 11px; letter-spacing: 1px; }
.stars i { color: var(--line); font-style: normal; }

.progress-mini { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.progress-mini .bar { flex: 1; }
.progress-mini span { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

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

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.card { padding: 15px 16px; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.card-head > div:first-child { min-width: 0; }
.card-head h3 { font-size: 14px; }
.card-head p { font-size: 11.5px; margin-top: 2px; }
.card-menu { margin-left: auto; display: flex; gap: 2px; flex: 0 0 auto; }
.progress-line { display: flex; align-items: center; gap: 10px; }
.progress-line .bar { flex: 1; }
.progress-line span { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tag {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 6px;
  color: var(--muted);
  background: var(--panel2);
  border: 1px solid var(--line);
}

.student-card { cursor: pointer; }
.stu-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #5b8cff, #8f6bff);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.stu-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 8px; }
.stu-metrics span { display: block; font-size: 11px; color: var(--muted); }
.stu-metrics strong { display: block; font-size: 16px; font-weight: 700; margin: 1px 0 5px; }
.stu-metrics .bar { height: 4px; }

/* ---------------- 模态框 ---------------- */

.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 8, 16, 0.62); backdrop-filter: blur(4px); }
.modal-card {
  position: relative;
  width: min(620px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 22px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: pop 0.18s ease-out;
}
.modal-card.wide { width: min(940px, 100%); }
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { font-size: 16px; }
.modal-head .muted { font-size: 12px; margin-top: 2px; }
.modal-head .icon-btn { margin-left: auto; flex: 0 0 auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.import-text {
  width: 100%;
  min-height: 200px;
  max-height: 320px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  font: 13px/1.7 "Cascadia Code", Consolas, monospace;
  resize: vertical;
  outline: none;
}
.import-text:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.import-help { margin: 8px 0; font-size: 12px; }
.import-help summary { cursor: pointer; color: var(--accent); }
.import-help pre {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--bg2);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre-wrap;
}
.import-result { max-height: 200px; overflow-y: auto; font-size: 12.5px; }
.import-result ul { margin: 6px 0; padding-left: 18px; line-height: 1.8; }
.imp-err { color: var(--bad); }

.step-row { display: grid; grid-template-columns: 1.35fr 1fr 30px; gap: 6px; margin-bottom: 6px; align-items: center; }.step-row input {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  outline: none;
}
.step-row input:focus { border-color: var(--accent); }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.problem-pick { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.pp-group + .pp-group { margin-top: 10px; }
.pp-title { font-size: 11.5px; color: var(--muted); padding: 4px 6px; }
.pick {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 12.5px;
  line-height: 1.5;
}
.pick:hover { background: var(--panel2); }
.pick input { margin-top: 2px; flex: 0 0 auto; }
.pick span { min-width: 0; }
.pick i { display: block; font-style: normal; font-size: 10.5px; color: var(--muted); }
.pick.line { width: 100%; }

.share-box { margin-top: 8px; }
.share-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
}
.share-row code { flex: 1; background: none; border: none; padding: 0; font-size: 13px; }

/* ---------------- 批改详情 ---------------- */

.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.statement { font-size: 14px; line-height: 1.8; margin-bottom: 4px; white-space: pre-wrap; }
.answer-box {
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg2);
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
}
.answer-box.ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: var(--ok-soft); }
.work-box {
  margin: 0;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg2);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
}
.verdict { padding: 8px 12px; border-radius: 9px; font-size: 12.5px; }
.verdict.v-ok { background: var(--ok-soft); color: var(--ok); }
.verdict.v-bad { background: var(--bad-soft); color: var(--bad); }
.issues { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.steps { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.8; }
.steps li { margin-bottom: 5px; display: flex; gap: 8px; align-items: flex-start; }
.steps li > div { flex: 1; }
.step-ok { color: var(--ok); flex: 0 0 auto; }
.step-bad { color: var(--bad); flex: 0 0 auto; }
.step-na { color: var(--muted); flex: 0 0 auto; }

.report-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 4px 0 16px; }
.report-stats > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
.report-stats span { display: block; font-size: 11px; color: var(--muted); }
.report-stats strong { font-size: 17px; font-weight: 700; }

.module-rows { display: flex; flex-direction: column; gap: 9px; }
.module-rows.pad { padding: 16px; }
.module-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.mr-name { flex: 0 0 96px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.module-row .bar { flex: 1; height: 6px; }
.mr-val { flex: 0 0 auto; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.advice { font-size: 13px; line-height: 1.8; padding: 10px 12px; border-radius: 9px; background: var(--accent-soft); color: var(--text); }

/* ---------------- 学生端 ---------------- */

.app.student { display: block; min-height: 100vh; }
.s-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px max(16px, calc((100vw - 880px) / 2));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
}
.s-who { display: flex; align-items: center; gap: 10px; }
.s-who strong { display: block; font-size: 13.5px; }
.s-who span { display: block; font-size: 11.5px; color: var(--muted); }
.s-top > .btn { margin-left: auto; }
.s-view { max-width: 880px; margin: 0 auto; padding: 22px 16px 60px; }

.s-hero { margin-bottom: 18px; }
.s-hero h1 { font-size: 21px; }
.s-hero p { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.s-hero.compact { display: flex; align-items: center; gap: 14px; margin: 12px 0 16px; }
.s-hero.compact h1 { font-size: 18px; }
.s-progress { margin-left: auto; font-size: 15px; font-weight: 700; color: var(--accent); }

.s-card { cursor: pointer; }
.back { display: inline-block; margin-bottom: 6px; padding-left: 0; font-size: 13px; }

.problem-card { padding: 18px; }
.problem-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.problem-card .statement { font-size: 15px; line-height: 1.9; margin-bottom: 18px; }
.answer-form { border-top: 1px solid var(--line); padding-top: 16px; }
.form-foot { display: flex; align-items: center; gap: 12px; }
.form-foot .btn { margin-left: auto; }

.feedback-panel { margin-bottom: 14px; }
.fb-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; }
.fb-detail { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.fb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding-top: 12px; }

.result-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.result-banner.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.result-banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.result-banner.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.rb-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.result-banner.ok .rb-icon { background: var(--ok); }
.result-banner.warn .rb-icon { background: var(--warn); color: #291a02; }
.result-banner.bad .rb-icon { background: var(--bad); }
.result-banner h2 { font-size: 16px; }
.result-banner p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.retry-panel { margin-top: 16px; }
.retry-panel .panel-head .chip { margin-left: auto; }
.retry-panel .statement { margin: 4px 0 10px; }

/* ---------------- 拍照交作业 ---------------- */

.mode-tabs { display: flex; gap: 6px; margin: 14px 0 12px; }
.mode-tabs button {
  flex: 1;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.mode-tabs button.on {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  color: var(--accent);
  font-weight: 600;
}

.camera-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 22px 14px;
  margin-bottom: 10px;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: center;
}
.camera-box:hover,
.camera-box:active { border-color: var(--accent); background: var(--accent-soft); }
.cam-ico { font-size: 26px; line-height: 1.3; }
.camera-box strong { font-size: 14px; }

.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo-grid:empty { display: none; }
.photo-grid.big { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin-bottom: 4px; }
.photo-item {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg2);
}
.photo-grid.big .photo-item { aspect-ratio: 4 / 5; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.photo-item img.proof { cursor: zoom-in; }
.photo-no {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 0 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 10.5px;
  line-height: 18px;
}
.photo-del {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.review-photos { margin-bottom: 14px; }

.thumb-wrap { position: relative; display: inline-block; }
.thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  cursor: zoom-in;
  vertical-align: middle;
}
.thumb-more {
  position: absolute;
  right: -4px;
  bottom: -4px;
  padding: 0 4px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 10px;
  font-style: normal;
  color: var(--muted);
}
.td-photo { width: 62px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 8, 16, 0.92);
  cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 8px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.lightbox-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}

/* ---------------- 答题卡 ---------------- */

.sheet-hint { font-size: 12.5px; color: var(--muted); margin: 12px 0 10px; }

.bubbles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.bubbles .bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: 0.15s;
}
.bubbles .bubble b {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}
.bubbles .bubble span { font-size: 13px; line-height: 1.5; }
.bubbles .bubble:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.bubbles .bubble.on { border-color: var(--accent); background: var(--accent-soft); }
.bubbles .bubble.on b { background: var(--accent); border-color: var(--accent); color: #fff; }

.opt-edit { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.opt-edit b { width: 22px; flex: 0 0 22px; font-size: 13px; color: var(--muted); }
.opt-edit input {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.chip.kind-single { color: #5b8cff; border-color: rgba(91, 140, 255, 0.4); background: rgba(91, 140, 255, 0.12); }
.chip.kind-multiple { color: #2ecc9b; border-color: rgba(46, 204, 155, 0.4); background: rgba(46, 204, 155, 0.12); }
.chip.kind-fill { color: #ffb454; border-color: rgba(255, 180, 84, 0.4); background: rgba(255, 180, 84, 0.12); }
.chip.kind-solve { color: #b787ff; border-color: rgba(183, 135, 255, 0.4); background: rgba(183, 135, 255, 0.12); }

/* ---------------- 答疑 ---------------- */

.qa { padding: 10px 0; border-bottom: 1px solid var(--line); }
.qa:last-child { border-bottom: none; }
.qa-q { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.qa-text { font-size: 13.5px; white-space: pre-wrap; margin-bottom: 8px; }
.qa-a {
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  padding: 9px 12px;
  border-radius: 0 8px 8px 0;
  background: var(--panel2);
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.qa-a.ok { border-left-color: var(--accent); color: var(--text); background: var(--accent-soft); }

/* ---------------- 实时答疑 ---------------- */

.chat-log {
  height: 340px;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-empty { margin: auto; color: var(--muted); font-size: 12.5px; text-align: center; line-height: 1.9; }
.chat-msg { display: flex; }
.chat-msg.me { justify-content: flex-end; }
.chat-msg .bubble {
  display: block;
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.ai .bubble { background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg.me .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.typing { color: var(--muted); font-size: 12.5px; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; }
.chat-form input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  outline: none;
}
.chat-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------------- 常驻答疑面板 ---------------- */

.chat-drawer {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(380px, calc(100vw - 28px));
  height: min(540px, 72vh);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 75;
  overflow: hidden;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.chat-head .icon-btn { margin-left: auto; }
.chat-drawer .chat-log { flex: 1; height: auto; border: none; border-radius: 0; background: var(--bg2); }
.chat-drawer .chat-form { margin: 0; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 74;
  padding: 10px 16px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(91, 140, 255, 0.35);
}
.chat-fab.hidden { display: none; }
@media (max-width: 820px) {
  .chat-drawer { left: 10px; right: 10px; bottom: 10px; width: auto; height: 64vh; }
}

/* ---------------- 公式面板 ---------------- */

.chat-input {
  flex: 1;
  min-height: 42px;
  max-height: 110px;
  overflow-y: auto;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.7;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-input:empty::before { content: attr(data-placeholder); color: var(--muted); }
.chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-input .chip { display: inline-block; padding: 1px 6px; margin: 0 2px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); }
.pal .fb-open { color: var(--accent); border-color: rgba(91, 140, 255, 0.5); font-weight: 600; }
.fb-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.fb-tabs button { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; }
.fb-tabs button.on { color: var(--accent); border-color: var(--accent); }
.fb-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.fb-row label { width: 56px; flex: 0 0 56px; font-size: 12.5px; color: var(--muted); }
.fb-row input { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: inherit; font-size: 13.5px; }
.fb-preview { margin-top: 12px; padding: 10px 14px; border-radius: 10px; border: 1px dashed var(--line); background: var(--bg2); }
.fb-preview > span { font-size: 11.5px; color: var(--muted); }
.fb-preview #fbPreview { min-height: 32px; font-size: 18px; padding-top: 4px; }

.chat-pal { padding: 0 12px; }
.pal {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.pal button {
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}
.pal button:hover { color: var(--text); border-color: var(--accent); }
.math { display: inline-block; }
.chat-msg .bubble .katex { font-size: 1.02em; }

/* ---------------- WPS 风格公式条 ---------------- */

.wps-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
  margin-bottom: 10px;
}
.wps-ribbon button {
  min-width: 52px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
.wps-ribbon button:hover { border-color: var(--accent); }
.wps-ribbon .pv { font-size: 14px; }
.mf-box {
  width: 100%;
  min-height: 96px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
  font-size: 20px;
}

/* ---------------- 公式键盘（输入框下方） ---------------- */

.modal { z-index: 100; }

.chat-math {
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 8px 12px 10px;
  max-height: 48vh;
  overflow-y: auto;
}
.chat-math.hidden { display: none; }
.chat-math-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.chat-math-actions { display: flex; gap: 8px; margin-top: 8px; }
.chat-math-actions .btn { flex: 1; }

.mf-box {
  width: 100%;
  min-height: 58px;
  max-height: 130px;
  overflow: auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
  color: var(--text);
  font-size: 18px;
}
math-field { color: var(--text); background: var(--bg2); }
math-field::part(virtual-keyboard-toggle) { display: none; }

/* ---------------- toast ---------------- */

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  max-width: 340px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  box-shadow: var(--shadow);
  animation: slide 0.2s ease-out;
}
.toast.err { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(6px); transition: 0.24s; }
@keyframes slide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

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

@media (max-width: 1040px) {
  .cols { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
  .fb-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .brand, .side-foot { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav-item { white-space: nowrap; padding: 7px 9px; font-size: 12.5px; }
  .nav-item .cnt { display: none; }
  .topbar { padding: 12px 14px; }
  .view { padding: 16px 14px 60px; }
  .field-row { grid-template-columns: 1fr; }
  .report-stats { grid-template-columns: repeat(3, 1fr); }
  .step-row { grid-template-columns: 1fr 30px; }
  .step-row .s-keys { grid-column: 1; }
  .toasts { left: 16px; right: 16px; align-items: stretch; }
  .toast { max-width: none; }

  /* 手机端：防 iOS 聚焦缩放、提交按钮更好按 */
  .field input, .field select, .field textarea { font-size: 16px; }
  .s-view { padding: 14px 12px 40px; }
  .problem-card { padding: 14px; overflow: visible; }
  .problem-card .statement { font-size: 15px; }
  .answer-form .form-foot {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 0 -14px -14px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: var(--panel);
    border-top: 1px solid var(--line);
  }
  .camera-box { padding: 18px 12px; }
  .photo-grid { gap: 6px; }
  .result-banner { align-items: flex-start; padding: 14px; }
  .s-hero h1 { font-size: 19px; }
  .share-row { flex-wrap: wrap; }
  .share-row code { width: 100%; word-break: break-all; }
}

/* ---------------- 手机端专项 ---------------- */

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

@media (max-width: 820px) {
  body.chat-open { overflow: hidden; }

  /* 全屏聊天：键盘弹出时用 visualViewport 高度，避免被挡 */
  .chat-drawer {
    left: 0;
    right: 0;
    top: var(--vv-top, 0px);
    bottom: auto;
    width: 100%;
    height: var(--vv-height, 100dvh);
    max-height: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  .chat-head {
    padding-top: calc(10px + env(safe-area-inset-top));
    font-size: 14.5px;
  }
  .chat-drawer .chat-log { padding: 12px 14px; }
  .chat-msg .bubble { font-size: 15px; line-height: 1.75; max-width: 88%; }
  .chat-form {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    gap: 6px;
  }
  .chat-input {
    font-size: 16px;
    min-height: 44px;
    max-height: 96px;
    padding: 10px 12px;
  }
  .chat-form .btn { min-height: 44px; padding: 0 14px; font-size: 14px; }
  .chat-math {
    max-height: 46%;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  }
  .wps-ribbon {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 2px 8px;
  }
  .wps-ribbon button {
    flex: 0 0 auto;
    min-width: 58px;
    height: 46px;
  }
  .wps-ribbon button .pv { font-size: 15px; }
  .mf-box { min-height: 66px; font-size: 20px; }

  .chat-fab {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    padding: 12px 18px;
    font-size: 14px;
  }

  /* 答题卡按钮更大、字更清楚 */
  .bubbles .bubble { padding: 14px; min-height: 56px; }
  .bubbles .bubble b { width: 32px; height: 32px; flex-basis: 32px; font-size: 14px; }
  .bubbles .bubble span { font-size: 14.5px; }
  .sheet-hint { font-size: 13px; }
  .problem-card .statement { font-size: 16px; line-height: 1.95; }
  .problem-meta .chip { font-size: 12px; }

  /* 顶部导航可横滑，不换行 */
  .nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
/* ---------------- 聊天图片 ---------------- */

.chat-attach {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  overflow-x: auto;
  background: var(--panel);
}
.chat-attach.hidden { display: none; }
.attach-item { position: relative; flex: 0 0 auto; }
.attach-item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.attach-item button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #ff5c6c;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.attach-hint { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.chat-img { display: block; max-width: 100%; border-radius: 8px; margin-bottom: 6px; }
/* ---------------- 聊天气泡排版 ---------------- */

.chat-msg .bubble {
  font-size: 15px;
  line-height: 1.85;
  letter-spacing: 0.2px;
  padding: 10px 13px;
  overflow-wrap: anywhere;
}
.chat-msg .bubble .chat-p { margin: 0 0 10px; }
.chat-msg .bubble .chat-p:last-child { margin-bottom: 0; }
.chat-msg .bubble .chat-list { margin: 4px 0 10px; padding-left: 20px; }
.chat-msg .bubble .chat-list li { margin: 4px 0; }
.chat-msg .bubble strong { font-weight: 600; }
.chat-msg .bubble code {
  background: var(--panel2);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 13px;
}
.chat-msg .bubble .katex { font-size: 1.05em; }
.chat-msg .bubble .katex-display {
  margin: 8px 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

@media (max-width: 820px) {
  .chat-msg .bubble {
    font-size: 15.5px;
    line-height: 1.9;
    max-width: 92%;
    padding: 11px 14px;
  }
  .chat-msg .bubble .katex { font-size: 1.08em; }
  .chat-msg .bubble .chat-list { padding-left: 18px; }
}
/* ---------------- 登录页 · 赛博朋克 ---------------- */

.login-screen {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(0, 240, 255, 0.12), transparent 42%),
    radial-gradient(circle at 82% 88%, rgba(255, 43, 214, 0.14), transparent 46%),
    #04060d;
  color: #d7f7ff;
}
.cyber-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cyber-grid {
  position: absolute;
  inset: -45% -25% -10%;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.16) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(620px) rotateX(60deg);
  transform-origin: center bottom;
  opacity: 0.55;
  animation: cyberGrid 16s linear infinite;
}
@keyframes cyberGrid { to { background-position: 0 46px, 46px 0; } }
.cyber-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  mix-blend-mode: screen;
}
.cyber-glow.g1 { width: 440px; height: 440px; left: -140px; top: -120px; background: #00f0ff; animation: cyberPulse 8s ease-in-out infinite; }
.cyber-glow.g2 { width: 400px; height: 400px; right: -120px; bottom: -140px; background: #ff2bd6; animation: cyberPulse 10s ease-in-out infinite reverse; }
@keyframes cyberPulse { 50% { opacity: 0.85; transform: scale(1.18); } }
.cyber-scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
  animation: cyberScan 9s linear infinite;
}
@keyframes cyberScan { to { background-position: 0 120px; } }

.login-screen .login-card {
  position: relative;
  z-index: 2;
  width: min(440px, calc(100vw - 32px));
  padding: 30px 28px 22px;
  background: linear-gradient(160deg, rgba(10, 20, 34, 0.94), rgba(7, 9, 20, 0.97));
  border: 1px solid rgba(0, 240, 255, 0.5);
  border-radius: 0;
  clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px);
  box-shadow:
    0 0 0 1px rgba(255, 43, 214, 0.16) inset,
    0 0 34px rgba(0, 240, 255, 0.18),
    0 0 70px rgba(255, 43, 214, 0.12);
  backdrop-filter: blur(6px);
}
.login-screen .login-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20px;
  width: 2px;
  height: 42px;
  background: #00f0ff;
  box-shadow: 0 0 12px #00f0ff;
}
.login-screen .login-card::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 20px;
  width: 42px;
  height: 2px;
  background: #ff2bd6;
  box-shadow: 0 0 12px #ff2bd6;
}

.login-screen .logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(0, 240, 255, 0.65);
  background: radial-gradient(circle at 30% 25%, rgba(0, 240, 255, 0.35), rgba(255, 43, 214, 0.22));
  color: #eafcff;
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 0 14px #00f0ff;
  box-shadow: 0 0 22px rgba(0, 240, 255, 0.45);
}

.login-screen .login-brand h1 {
  font-family: "JetBrains Mono", Consolas, "Microsoft YaHei", monospace;
  font-size: 19px;
  letter-spacing: 2px;
  color: #eafcff;
  text-shadow: 0 0 14px rgba(0, 240, 255, 0.75);
}
.login-screen .login-sub {
  font-family: Consolas, monospace;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: #6fd6e8;
  margin-top: 4px;
  text-transform: uppercase;
}

.glitch { position: relative; }
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
}
.glitch::before { color: #00f0ff; transform: translate(-1px, -2px); clip-path: inset(0 0 56% 0); opacity: 0; animation: glitchA 3.4s infinite linear alternate; }
.glitch::after { color: #ff2bd6; transform: translate(1px, 2px); clip-path: inset(56% 0 0 0); opacity: 0; animation: glitchB 2.9s infinite linear alternate; }
@keyframes glitchA { 0%, 91%, 100% { opacity: 0; transform: translate(0, 0); } 92% { opacity: 0.85; transform: translate(-3px, -1px); } 95% { opacity: 0.7; transform: translate(2px, 1px); } }
@keyframes glitchB { 0%, 89%, 100% { opacity: 0; transform: translate(0, 0); } 90% { opacity: 0.8; transform: translate(3px, 1px); } 94% { opacity: 0.65; transform: translate(-2px, -1px); } }

.login-screen .tabs {
  border: 1px solid rgba(0, 240, 255, 0.22);
  background: rgba(0, 240, 255, 0.05);
  border-radius: 10px;
}
.login-screen .tab {
  font-family: Consolas, monospace;
  letter-spacing: 1px;
  color: #7fd8e6;
  border-radius: 7px;
}
.login-screen .tab.on {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.24), rgba(255, 43, 214, 0.24));
  color: #ffffff;
  text-shadow: 0 0 10px #00f0ff;
}

.login-screen .field span {
  color: #8fe9ff;
  font-family: Consolas, monospace;
  font-size: 11.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.login-screen .field input {
  background: rgba(0, 18, 28, 0.75);
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: #eafcff;
  box-shadow: inset 0 0 14px rgba(0, 240, 255, 0.08);
  caret-color: #00f0ff;
}
.login-screen .field input::placeholder { color: rgba(150, 220, 235, 0.45); }
.login-screen .field input:focus {
  border-color: #00f0ff;
  box-shadow: 0 0 0 1px #00f0ff, 0 0 20px rgba(0, 240, 255, 0.45);
  outline: none;
}

.login-screen .btn.primary {
  background: linear-gradient(90deg, #00f0ff, #7a5cff 52%, #ff2bd6);
  color: #04121a;
  font-weight: 700;
  letter-spacing: 1.5px;
  border: none;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.45);
  text-transform: uppercase;
}
.login-screen .btn.primary:hover { filter: brightness(1.12); box-shadow: 0 0 30px rgba(255, 43, 214, 0.55); }

.login-screen .login-tip { color: #6fb6c9; font-size: 11.5px; }
.login-code {
  margin-top: 10px;
  text-align: center;
  font-family: Consolas, monospace;
  font-size: 9.5px;
  letter-spacing: 1.6px;
  color: rgba(0, 240, 255, 0.35);
}

@media (max-width: 480px) {
  .login-screen .login-card { padding: 24px 20px 18px; width: calc(100vw - 24px); }
  .login-screen .login-brand h1 { font-size: 17px; letter-spacing: 1px; }
  .login-screen .login-sub { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .cyber-grid, .cyber-scan, .cyber-glow, .glitch::before, .glitch::after { animation: none; }
}/* ---------------- 本题公式 ---------------- */

.formula-list {
  margin: 6px 0 14px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.9;
}
.formula-list li { margin: 3px 0; color: var(--text); }
.formula-list li::marker { color: var(--accent); }
/* ---------------- 任务编辑器：选择项排版 ---------------- */

.pick-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }

.pick {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  column-gap: 8px;
  align-items: start;
}
.pick input { margin-top: 3px; grid-column: 1; }
.pick span {
  grid-column: 2;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pick i {
  display: inline;
  margin-left: 6px;
  font-style: normal;
  font-size: 10.5px;
  color: var(--muted);
}

.pick.line { width: 100%; }
.pick.line span {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pick.line i { display: block; margin-left: 0; margin-top: 2px; }

.problem-pick { width: 100%; max-height: 360px; }
.pp-group { width: 100%; }
/* 复选框/单选框不能被 .field input 的 100% 宽度撑爆 */
.field input[type="checkbox"],
.field input[type="radio"] {
  width: auto;
  height: auto;
  padding: 0;
  box-shadow: none;
  accent-color: var(--accent);
}
.pick input[type="checkbox"] { width: auto; height: auto; }
/* ---------------- 内容库 · 题型树 ---------------- */

.p-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 14px; align-items: start; }
.p-tree { padding: 10px 10px 12px; position: sticky; top: 10px; max-height: calc(100vh - 110px); overflow: auto; }
.p-tree-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.p-tree-body { display: flex; flex-direction: column; gap: 2px; }
.tnode summary { list-style: none; cursor: pointer; padding: 6px; border-radius: 8px; display: flex; align-items: center; gap: 6px; font-size: 13px; }
.tnode summary::-webkit-details-marker { display: none; }
.tnode summary:hover { background: var(--panel2); }
.tnode summary i { margin-left: auto; font-style: normal; color: var(--muted); font-size: 11px; }
.tnode.sub { margin-left: 12px; }
.tleaf {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 24px);
  text-align: left;
  padding: 5px 8px;
  margin-left: 24px;
  margin-bottom: 2px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  border-radius: 7px;
  cursor: pointer;
}
.tleaf:hover { background: var(--panel2); }
.tleaf.on { background: var(--accent-soft); color: var(--accent); }
.tleaf i { margin-left: auto; font-style: normal; color: var(--muted); font-size: 11px; }
@media (max-width: 900px) {
  .p-layout { grid-template-columns: 1fr; }
  .p-tree { position: static; max-height: none; }
}
/* ---------------- 题图 ---------------- */

.problem-fig {
  display: block;
  max-width: min(100%, 420px);
  margin: -6px 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.tbl-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  margin-right: 8px;
  vertical-align: middle;
  background: #fff;
}
/* ---------------- 计算练习 ---------------- */

.calc-entry { margin: 0 0 16px; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.calc-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.calc-card:hover { border-color: var(--accent); }
.calc-card strong { font-size: 15px; }
.calc-card span { font-size: 12.5px; color: var(--muted); }
.calc-panel { padding: 18px; }
.calc-q {
  white-space: pre-wrap;
  font-size: 17px;
  line-height: 1.8;
  margin-bottom: 8px;
  font-family: "Cambria Math", Consolas, "Microsoft YaHei", serif;
}
.calc-result { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.calc-result.ok { background: rgba(46, 204, 155, 0.12); color: #1f9d76; border: 1px solid rgba(46, 204, 155, 0.4); }
.calc-result.bad { background: rgba(255, 92, 108, 0.12); color: #c93a4a; border: 1px solid rgba(255, 92, 108, 0.4); }
/* ---------------- 过定点联立 / 计算练习聊天 ---------------- */

.calc-modes { display: flex; flex-direction: column; gap: 6px; }
.calc-mode { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); }
.calc-detail { margin: 8px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.9; }
.calc-detail .ok { color: #1f9d76; font-weight: 700; }
.calc-detail .bad { color: #c93a4a; font-weight: 700; }
.calc-chat { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg2); display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.calc-msg { max-width: 88%; padding: 8px 11px; border-radius: 10px; font-size: 13.5px; line-height: 1.7; }
.calc-msg.ai { background: var(--panel); border: 1px solid var(--line); align-self: flex-start; }
.calc-msg.me { background: var(--accent); color: #fff; align-self: flex-end; }