:root {
  --ink: #12233f; --muted: #64748b; --blue: #0877d1; --cyan: #11a8e6;
  --soft-blue: #edf7ff; --line: #dce7f2; --page: #f3f7fb; --white: #fff;
  --red: #c62828; --red-bg: #fff1f1; --green: #147d50; --green-bg: #ecfdf5;
  --shadow: 0 14px 40px rgba(30, 64, 110, .09); --radius: 18px;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-family: "Segoe UI", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--page); line-height: 1.65; }
header { padding: 25px 24px 37px; text-align: center; color: white; background: linear-gradient(120deg, #183f91, #0aa8e4); }
header h1 { margin: 0; font-size: clamp(25px, 3vw, 35px); letter-spacing: 1px; }
header p { margin: 5px 0 0; color: #d9f3ff; }
.progress { display: flex; max-width: 1280px; margin: -21px auto 0; padding: 0 20px 8px; gap: 8px; overflow-x: auto; scrollbar-width: thin; }
.step { flex: 0 0 auto; margin: 0; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); box-shadow: 0 4px 12px rgba(31, 72, 122, .08); cursor: pointer; }
.step.active { color: white; border-color: transparent; background: linear-gradient(120deg, var(--cyan), var(--blue)); }
.step.done { color: var(--green); border-color: #9dd7bd; }
.step:disabled { cursor: not-allowed; opacity: .58; }
main { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, .8fr); gap: 22px; max-width: 1360px; margin: 18px auto; padding: 0 20px 30px; align-items: start; min-width: 0; }
.panel { min-width: 0; background: white; border: 1px solid #e8eef5; border-radius: var(--radius); box-shadow: var(--shadow); }
.work-panel { padding: clamp(22px, 3vw, 38px); min-height: 680px; }
.stage { display: none; }
.stage.active { display: block; animation: enter .28s ease; }
@keyframes enter { from { opacity: 0; transform: translateY(7px); } }
.eyebrow { color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: 1.7px; }
h2 { margin: 3px 0 8px; font-size: 24px; }
h3 { margin: 0 0 10px; font-size: 16px; }
.lead { margin: 0 0 20px; color: var(--muted); }
.known-card, .definition, .derivation-card { margin: 18px 0; padding: 18px; border: 1px solid #bee1f6; border-radius: 12px; background: var(--soft-blue); }
.known-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
label { color: #34465f; font-weight: 650; font-size: 14px; }
input, select { width: 100%; margin-top: 6px; padding: 10px 11px; border: 1px solid #cbd8e7; border-radius: 8px; background: white; color: var(--ink); font: inherit; outline: none; }
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(17, 168, 230, .13); }
.formula { padding: 18px; margin: 18px 0; overflow-x: auto; text-align: center; border: 1px dashed #8acff0; border-radius: 11px; background: #f0faff; color: #075d98; }
.formula.compact { background: white; margin: 10px 0; }
.table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; min-width: 650px; }
.data-table th { color: #446079; background: #f5f8fb; }
.data-table th, .data-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.data-table td:first-child { font-weight: 700; }
.data-table input { min-width: 100px; margin: 0; }
.classification-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.classification-guide div { padding: 16px; border-radius: 11px; border: 1px solid var(--line); background: #f8fafc; }
.classification-guide b, .classification-guide span { display: block; }
.classification-guide b { color: var(--blue); }
.classification-guide span { margin-top: 5px; color: var(--muted); }
.classify-grid, .answer-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.classify-grid label, .answer-grid label, .single-answer { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fbfdff; }
.answer-grid small { display: block; margin-top: 4px; color: var(--muted); font-weight: 400; }
.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.summary-grid div { padding: 13px; background: #f7fafc; border-radius: 9px; border: 1px solid var(--line); }
.summary-grid b, .summary-grid span, .summary-grid small { display: block; }
.summary-grid span { color: #38516e; }
.summary-grid small { color: var(--muted); }
.primary, .secondary { width: 100%; margin-top: 20px; padding: 12px 18px; border: 0; border-radius: 9px; font-size: 16px; font-weight: 750; cursor: pointer; }
.primary { color: white; background: linear-gradient(110deg, var(--cyan), #2468ee); box-shadow: 0 8px 18px rgba(22, 126, 218, .22); }
.secondary { width: auto; color: #0871b7; border: 1px solid #8ed0ee; background: white; }
.secondary.full { width: 100%; }
button:disabled { cursor: not-allowed; opacity: .62; box-shadow: none; }
.feedback { display: none; margin-top: 16px; padding: 12px 14px; border-radius: 9px; gap: 10px; align-items: flex-start; }
.feedback.show { display: flex; }
.feedback > b { display: grid; place-items: center; flex: 0 0 24px; height: 24px; border-radius: 50%; color: white; }
.feedback.error { color: var(--red); background: var(--red-bg); border: 1px solid #ffc5c5; }
.feedback.error > b { background: var(--red); }
.feedback.success { color: var(--green); background: var(--green-bg); border: 1px solid #a7e3c6; }
.feedback.success > b { background: var(--green); }
.formula-stack > div:first-child { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-left: 4px solid var(--blue); background: #f6faff; }
.formula-stack > div:first-child span { color: var(--muted); font-size: 12px; font-weight: 750; letter-spacing: 1px; }
.derivatives { margin-top: 14px; padding: 16px 20px; border-radius: 10px; background: #f4fbf7; border: 1px solid #b7e3cb; }
.derivatives p { margin: 8px 0; }
.unit-note, .round-note { padding: 9px 12px; color: #805500; background: #fff8db; border-radius: 7px; }
.single-answer { display: block; margin: 12px 0; }
.lookup-result { margin-top: 12px; padding: 14px; text-align: center; color: #075d98; background: var(--soft-blue); border-radius: 8px; }
.contribution-bars > div { display: grid; grid-template-columns: 150px 1fr 110px; gap: 12px; align-items: center; margin: 14px 0; }
.bar-track { height: 13px; overflow: hidden; border-radius: 999px; background: #e7eef5; }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #19b2e8, #2563eb); }
.contribution-bars b { font-size: 12px; }
.final-report { margin-top: 18px; padding: 20px; border-radius: 12px; color: #125b3d; background: var(--green-bg); border: 1px solid #9edabd; }
.hidden { display: none !important; }
.assistant-panel { position: sticky; top: 16px; padding: 20px; }
.assistant-title { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.assistant-title > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: white; font-weight: 900; background: linear-gradient(135deg, var(--cyan), #2269ee); }
.assistant-title h2, .assistant-title p { margin: 0; }
.assistant-title h2 { font-size: 19px; }
.assistant-title p { color: var(--muted); font-size: 12px; }
.chat-box { height: 560px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #f7fafc; }
.chat-box { scrollbar-width: thin; scrollbar-color: #d3dee8 transparent; }
.chat-box::-webkit-scrollbar { width: 5px; }
.chat-box::-webkit-scrollbar-track { background: transparent; }
.chat-box::-webkit-scrollbar-thumb { background: #d3dee8; border-radius: 999px; }
.chat-box::-webkit-scrollbar-button { display: none; }
.msg { max-width: 92%; padding: 11px 13px; border-radius: 12px; font-size: 14px; }
.msg.ai { align-self: flex-start; color: #075b8e; background: #e2f5ff; }
.msg.student { align-self: flex-end; color: #11603e; background: #def8e9; }
.hint-tag { display: inline-block; margin-right: 7px; padding: 2px 7px; border-radius: 999px; color: white; background: #0c82c9; font-size: 11px; }
.msg.ai.error-hint { color: #8f2430; background: #fff0f1; border: 1px solid #f2b5ba; box-shadow: 0 4px 12px rgba(178, 49, 62, 0.08); }
.msg.ai.error-hint .hint-tag { background: #c93645; }
.chat-input { display: flex; gap: 8px; margin-top: 12px; }
.chat-input input { margin: 0; min-width: 0; flex: 1; }
.chat-input button { flex: 0 0 auto; white-space: nowrap; padding: 0 18px; border: 0; border-radius: 8px; color: white; background: var(--blue); cursor: pointer; }
.lab-page .progress { margin-top: 12px; }
.stage, .answer-grid > *, .known-grid > *, .derivation-card { min-width: 0; }
mjx-container { max-width: 100%; }
mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; padding-bottom: 5px; }
.msg { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 940px) { main { grid-template-columns: minmax(0, 1fr); } .assistant-panel { position: static; } .chat-box { height: 320px; } }
@media (max-width: 650px) { .known-grid, .classification-guide, .classify-grid, .answer-grid, .summary-grid { grid-template-columns: 1fr; } .work-panel { padding: 20px 15px; } main { padding: 0 10px 20px; } .contribution-bars > div { grid-template-columns: 110px 1fr; } .contribution-bars b { grid-column: 2; } }
@media (max-width: 650px) {
  .lab-page header { padding: 20px 16px; }
  .lab-page header h1 { font-size: 21px; line-height: 1.5; letter-spacing: 0; overflow-wrap: anywhere; }
  .lab-page header h1 > span { display: block; }
  .lab-page header h1 .title-divider { display: none; }
  .lab-page header h1 .lab-subtitle { font-size: 17px; margin-top: 5px; }
  .lab-page header p { font-size: 13px; line-height: 1.6; }
  .lab-page .lab-bar { margin: 10px; padding: 12px; gap: 8px; }
  .lab-page .lab-bar strong { flex-basis: 100%; overflow-wrap: anywhere; }
  .lab-page .progress { padding-left: 10px; padding-right: 10px; }
  .lab-page h2 { font-size: 21px; }
  .lab-page .assistant-panel { padding: 16px; }
  .lab-page .known-card, .lab-page .derivation-card { padding: 12px; }
  .lab-page .table-wrap::before { content: '表格可左右滑动查看'; display: block; position: sticky; left: 0; color: var(--muted); font-size: 12px; padding: 0 0 8px; }
}
