/* 作业错误归因分析 - 样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", sans-serif;
  background: #f5f7fa;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部 */
.topbar {
  background: #4285f4;
  color: #fff;
  padding: 14px 0;
  box-shadow: 0 2px 8px rgba(66,133,244,.3);
}
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar h1 { font-size: 20px; font-weight: 600; }
.topbar .sub { font-size: 12px; opacity: .85; margin-left: 6px; }
/* 右上角返回工作平台按钮（与平台 header 风格统一） */
.topbar-back {
  margin-left: auto;
  background: #fff;
  color: #4285f4;
  border: none;
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.topbar-back:hover { background: #e8f0fe; }

/* 主体 */
.container {
  max-width: 1120px;
  margin: 20px auto 40px;
  padding: 0 16px;
  width: 100%;
  flex: 1;
}

/* 左右两栏布局 */
.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}
.col { min-width: 0; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  margin-bottom: 18px;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #eef0f3;
  cursor: pointer;
  user-select: none;
}
.card-head h2 { font-size: 16px; font-weight: 600; color: #1a1a1a; }
.card-body { padding: 18px; }

.tag {
  font-size: 12px;
  background: #e8f0fe;
  color: #4285f4;
  border-radius: 20px;
  padding: 3px 10px;
}
.collapse-btn { font-size: 12px; color: #999; }

/* 表单 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-wide { grid-column: 1 / -1; }
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #2c5fb0;
  font-weight: 600;
  margin: 6px 0 14px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e6eaf0;
}
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: #555; margin-bottom: 6px; font-weight: 500; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid #d9dee5;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s;
  background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: #4285f4; box-shadow: 0 0 0 3px rgba(66,133,244,.12); }
.field textarea { resize: vertical; line-height: 1.6; }

.prompt-toggle { display: flex; gap: 20px; margin-bottom: 10px; }
.radio { font-size: 14px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.radio input { accent-color: #4285f4; width: 15px; height: 15px; }

.hint-text { font-size: 12px; color: #999; background: #fafbfc; border-radius: 6px; padding: 10px 12px; line-height: 1.6; }

/* 上传区 */
.dropzone {
  border: 2px dashed #c8d2e0;
  border-radius: 10px;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #fafcff;
}
.dropzone:hover, .dropzone.drag { border-color: #4285f4; background: #eef4ff; }
.dropzone p { margin-top: 10px; font-size: 14px; color: #555; }
.dropzone .small { font-size: 12px; color: #aaa; margin-top: 4px; }

.preview { margin-top: 14px; text-align: center; }
.preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}
.preview-item {
  position: relative;
  width: 120px;
  border: 1px solid #e6eaf0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  text-align: center;
}
.preview-item img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
  background: #f5f7fa;
}
.pdf-icon {
  width: 100%;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fdecea;
  color: #c0392b;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
}
.pv-name {
  font-size: 11px;
  color: #666;
  padding: 4px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pv-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  line-height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}
.pv-del:hover { background: #c0392b; }
.preview-actions { margin-top: 10px; }

/* 按钮 */
.btn {
  border: none;
  border-radius: 6px;
  padding: 10px 22px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.btn.primary { background: #4285f4; color: #fff; font-weight: 500; }
.btn.primary:hover { background: #3b76e0; }
.btn.primary:disabled { background: #a8c4f2; cursor: not-allowed; }
.btn.ghost { background: #fff; color: #4285f4; border: 1px solid #4285f4; }
.btn.ghost:hover { background: #eef4ff; }

#analyzeBtn { margin-top: 16px; width: 100%; padding: 12px; font-size: 15px; }

/* 状态 */
.status { margin-top: 14px; padding: 12px 14px; border-radius: 8px; font-size: 14px; line-height: 1.6; }
.status.loading { background: #eef4ff; color: #2c5fb0; }
.status.error { background: #fdecea; color: #c0392b; }
.status.ok { background: #e8f7ee; color: #1e7d3e; }

/* 结果 */
.head-actions .btn { padding: 7px 16px; font-size: 13px; }

.result-title { text-align: center; margin-bottom: 6px; }
.result-title h3 { font-size: 22px; font-weight: 700; }
.result-title .en { font-size: 12px; color: #aaa; letter-spacing: 1px; }
.result-coverage {
  text-align: center;
  color: #666;
  font-size: 13px;
  margin-bottom: 20px;
  background: #fafbfc;
  border-radius: 8px;
  padding: 8px 12px;
  display: inline-block;
  width: 100%;
}

.kp-block {
  border: 1px solid #e6eaf0;
  border-radius: 10px;
  margin-bottom: 18px;
  overflow: hidden;
}
.kp-head {
  background: #f4f8ff;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  color: #2c5fb0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kp-head .dot { width: 8px; height: 8px; border-radius: 50%; background: #4285f4; display: inline-block; }
.kp-body { padding: 8px 16px 14px; }

.item {
  border-bottom: 1px dashed #e6eaf0;
  padding: 14px 0;
}
.item:last-child { border-bottom: none; }

.item-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.badge {
  font-size: 12px;
  border-radius: 20px;
  padding: 2px 10px;
  font-weight: 500;
}
.badge.correct { background: #e8f7ee; color: #1e7d3e; }
.badge.wrong   { background: #fdecea; color: #c0392b; }
.item-type { font-size: 12px; color: #999; background: #f0f2f5; border-radius: 4px; padding: 2px 8px; }
.item-type.errtype { color: #7a4d0e; background: #fdf6ec; }

.item-row { margin-bottom: 6px; font-size: 14px; line-height: 1.7; }
.item-row .lb { color: #888; font-size: 12px; margin-right: 6px; flex-shrink: 0; }
.item-question { color: #333; }
.item-answer { color: #555; }

.reason {
  background: #fdf6ec;
  border-left: 3px solid #f0a24a;
  border-radius: 0 6px 6px 0;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.7;
  color: #7a4d0e;
  margin-top: 8px;
}
.hint {
  background: #eef7ff;
  border-left: 3px solid #4285f4;
  border-radius: 0 6px 6px 0;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.7;
  color: #1c4d8f;
  margin-top: 8px;
}

/* 详细讲解版：正确解法（绿色） */
.solution {
  background: #e8f7ee;
  border-left: 3px solid #28a745;
  border-radius: 0 6px 6px 0;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.7;
  color: #1e7d3e;
  margin-top: 8px;
}

/* 下一步/变式建议 */
.next {
  background: #f5f3ff;
  border-left: 3px solid #8b7cf6;
  border-radius: 0 6px 6px 0;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.7;
  color: #4a3f9e;
  margin-top: 8px;
}

/* 光谱归因（SPECTR） */
.spectr-box {
  background: #faf7ff;
  border: 1px solid #e6ddf5;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 8px;
}
.spectr-title { font-weight: 600; color: #6b4fa0; margin-bottom: 6px; font-size: 13px; }
.spectr-item { margin-bottom: 8px; font-size: 13px; line-height: 1.7; }
.spectr-item:last-child { margin-bottom: 0; }
.spectr-layer {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  margin-right: 6px;
  vertical-align: middle;
}
.spectr-layer.s { background: #4285f4; }  /* 情境 */
.spectr-layer.p { background: #f0a24a; }  /* 知识 */
.spectr-layer.c { background: #8b7cf6; }  /* 思维 */
.spectr-layer.e { background: #17a2b8; }  /* 表达 */
.spectr-layer.t { background: #28a745; }  /* 实验 */
.spectr-layer.r { background: #9aa0a6; }  /* 过失 */
.spectr-name { font-weight: 500; color: #4a3f9e; }
.spectr-role {
  font-size: 11px;
  background: #e8f0fe;
  color: #2c5fb0;
  border-radius: 10px;
  padding: 1px 8px;
  margin-left: 6px;
}
.spectr-tag { color: #7a4d0e; margin-top: 2px; }
.spectr-detail { color: #555; margin-top: 2px; }

/* 矫正策略 */
.correction {
  background: #fdf9ee;
  border-left: 3px solid #f0a24a;
  border-radius: 0 6px 6px 0;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.7;
  color: #6b4a12;
  margin-top: 8px;
}

.summary-box {
  background: #f4f8ff;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.8;
  color: #2c5fb0;
  margin-top: 4px;
}
.summary-box .lb { font-weight: 600; }

/* ===== 右侧：教学建议 ===== */
.advice-placeholder { color: #aaa; font-size: 13px; padding: 10px 2px; }
.advice-box {
  background: #fdf9ee;
  border-left: 4px solid #f0a24a;
  border-radius: 0 8px 8px 0;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.9;
  color: #6b4a12;
  white-space: pre-wrap;
}

/* ===== 右侧：变式题 ===== */
.variant-tip { font-size: 12px; color: #999; margin-bottom: 12px; line-height: 1.6; }
#variantBtn { width: 100%; }

.variant-box { margin-top: 14px; border: 1px solid #e6eaf0; border-radius: 10px; overflow: hidden; }
.variant-head {
  background: #f4f8ff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.variant-head .vp { font-size: 14px; font-weight: 600; color: #2c5fb0; }
.variant-head .diff {
  font-size: 12px;
  border-radius: 20px;
  padding: 2px 10px;
  background: #e8f7ee;
  color: #1e7d3e;
}
.variant-body { padding: 14px 16px; font-size: 14px; line-height: 1.9; }
.variant-body .row { margin-bottom: 8px; }
.variant-body .lb { color: #888; font-size: 12px; margin-right: 6px; }
.variant-q { font-weight: 500; color: #1a1a1a; }
.variant-opt { padding-left: 6px; color: #444; }
.variant-ans { color: #1e7d3e; font-weight: 500; }
.variant-sol { background: #f5f7fa; border-radius: 8px; padding: 10px 12px; margin-top: 6px; color: #444; }
.variant-var { background: #fdf9ee; border-radius: 8px; padding: 10px 12px; margin-top: 6px; color: #7a5a15; }

.foot {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  padding: 18px 0 30px;
}

@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
}
